@@ -187,45 +187,29 @@ export async function exportVariantAnalysisResults(
187187 throw new UserCancellationException ( "Cancelled" ) ;
188188 }
189189
190+ const repositories = filterAndSortRepositoriesWithResults (
191+ variantAnalysis . scannedRepos ,
192+ filterSort ,
193+ ) ?. filter (
194+ ( repo ) =>
195+ repo . resultCount &&
196+ repoStates . find ( ( r ) => r . repositoryId === repo . repository . id )
197+ ?. downloadStatus ===
198+ VariantAnalysisScannedRepositoryDownloadStatus . Succeeded ,
199+ ) ;
200+
190201 async function * getAnalysesResults ( ) : AsyncGenerator <
191202 [ VariantAnalysisScannedRepository , VariantAnalysisScannedRepositoryResult ]
192203 > {
193204 if ( ! variantAnalysis ) {
194205 return ;
195206 }
196207
197- const repositories = filterAndSortRepositoriesWithResults (
198- variantAnalysis . scannedRepos ,
199- filterSort ,
200- ) ;
201208 if ( ! repositories ) {
202209 return ;
203210 }
204211
205212 for ( const repo of repositories ) {
206- const repoState = repoStates . find (
207- ( r ) => r . repositoryId === repo . repository . id ,
208- ) ;
209-
210- // Do not export if it has not yet completed or the download has not yet succeeded.
211- if (
212- repoState ?. downloadStatus !==
213- VariantAnalysisScannedRepositoryDownloadStatus . Succeeded
214- ) {
215- continue ;
216- }
217-
218- if ( repo . resultCount == 0 ) {
219- yield [
220- repo ,
221- {
222- variantAnalysisId : variantAnalysis . id ,
223- repositoryId : repo . repository . id ,
224- } ,
225- ] ;
226- continue ;
227- }
228-
229213 const result = await variantAnalysisManager . loadResults (
230214 variantAnalysis . id ,
231215 repo . repository . fullName ,
@@ -259,6 +243,7 @@ export async function exportVariantAnalysisResults(
259243 exportedResultsDirectory ,
260244 variantAnalysis ,
261245 getAnalysesResults ( ) ,
246+ repositories ?. length ?? 0 ,
262247 exportFormat ,
263248 progress ,
264249 token ,
@@ -272,6 +257,7 @@ export async function exportVariantAnalysisAnalysisResults(
272257 analysesResults : AsyncIterable <
273258 [ VariantAnalysisScannedRepository , VariantAnalysisScannedRepositoryResult ]
274259 > ,
260+ expectedAnalysesResultsCount : number ,
275261 exportFormat : "gist" | "local" ,
276262 progress : ProgressCallback ,
277263 token : CancellationToken ,
@@ -289,6 +275,7 @@ export async function exportVariantAnalysisAnalysisResults(
289275 const { markdownFiles, summaries } = await generateVariantAnalysisMarkdown (
290276 variantAnalysis ,
291277 analysesResults ,
278+ expectedAnalysesResultsCount ,
292279 exportFormat ,
293280 ) ;
294281 const description = buildVariantAnalysisGistDescription (
0 commit comments