@@ -340,13 +340,16 @@ class GetAllRunsUseCase {
340340 }
341341
342342 if ( dataPassIds ) {
343+ const whereDataPassIds = dataPassIds . length === 1
344+ ? { id : { [ Op . eq ] : dataPassIds [ 0 ] } }
345+ : { id : { [ Op . in ] : dataPassIds } } ;
343346 const runNumbers = ( await RunRepository . findAll ( {
344347 attributes : [ 'runNumber' ] ,
345348 raw : true ,
346349 include : [
347350 {
348351 association : 'dataPass' ,
349- where : { id : { [ Op . in ] : dataPassIds } } ,
352+ where : whereDataPassIds ,
350353 } ,
351354 ] ,
352355 } ) ) . map ( ( { runNumber } ) => runNumber ) ;
@@ -529,15 +532,17 @@ class GetAllRunsUseCase {
529532 const qcFlagsAssociationDef = {
530533 association : 'qcFlags' ,
531534 required : false ,
535+ separate : true ,
532536 where : { [ Op . and ] : [
533537 { deleted : false } ,
534538 sequelize . literal ( `(
535- \`qcFlags-> detector\`.\`type\` not in (${ detectorTypesOfNoneExportableAnonymousFlagsEscaped } )
536- OR \`qcFlags-> createdBy\`.\`name\` != 'Anonymous'
539+ \`detector\`.\`type\` not in (${ detectorTypesOfNoneExportableAnonymousFlagsEscaped } )
540+ OR \`createdBy\`.\`name\` != 'Anonymous'
537541 )` ) ,
538542 ] } ,
539543 include : [
540544 { association : 'effectivePeriods' , required : true } ,
545+ { association : 'effectivePeriods' , required : true , separate : true } ,
541546 { association : 'flagType' } ,
542547 { association : 'detector' , required : true } ,
543548 { association : 'createdBy' } ,
0 commit comments