Skip to content

Commit f35d520

Browse files
committed
logic fixes
1 parent e8f9bf9 commit f35d520

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/domain/dtos/filters/RunFilterDto.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ exports.RunFilterDto = Joi.object({
128128
})
129129
.custom((detectorsQcObj, helpers) => {
130130
const [{ dataPassIds, simulationPassIds, lhcPeriodIds }] = helpers.state.ancestors;
131-
const filters = [dataPassIds, simulationPassIds, lhcPeriodIds].filter(({ length } = {}) => length === 1);
131+
const runsCollectionFilters = [dataPassIds, simulationPassIds, lhcPeriodIds].filter(({ length } = {}) => length >= 1);
132132

133-
if (filters.length !== 1) {
133+
if (runsCollectionFilters.length !== 1 || runsCollectionFilters[0].length !== 1) {
134134
return helpers.error('any.invalid', {
135135
message: 'Filtering by detector not-bad fraction is allowed only with exactly one of: ' +
136136
'dataPassIds, simulationPassIds, lhcPeriodIds with exactly one ID.',

lib/server/services/qualityControlFlag/QcFlagSummaryService.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ class QcFlagSummaryService {
7878
* @param {number} [scope.dataPassId] data pass id - exclusive with other options
7979
* @param {number} [scope.simulationPassId] simulation pass id - exclusive with other options
8080
* @param {number} [scope.lhcPeriodId] id of LHC Period - exclusive with other options
81-
* @param {number} [scope.dplDetectorIds] ids of dpl detectors
81+
* @param {number[]} [scope.dplDetectorIds] ids of dpl detectors
8282
* @param {object} [options] additional options
8383
* @param {boolean} [options.mcReproducibleAsNotBad = false] if set to true, `Limited Acceptance MC Reproducible` flag type is treated as
8484
* good one
8585
* @return {Promise<QcSummary>} summary
8686
*/
8787
async getSummary({ dataPassId, simulationPassId, lhcPeriodId, dplDetectorIds }, { mcReproducibleAsNotBad = false } = {}) {
88-
if (Boolean(dataPassId) + Boolean(simulationPassId) + Boolean(lhcPeriodId) > 1) {
89-
throw new BadParameterError('`dataPassId`, `simulationPassId` and `lhcPeriodId` are exclusive options');
88+
if (Boolean(dataPassId) + Boolean(simulationPassId) + Boolean(lhcPeriodId) !== 1) {
89+
throw new BadParameterError('One and exactly one of `dataPassId`, `simulationPassId` and `lhcPeriodId` is required');
9090
}
9191

9292
const queryBuilder = dataSource.createQueryBuilder()

0 commit comments

Comments
 (0)