Skip to content

Commit 8a91b60

Browse files
committed
fixes
1 parent 534e893 commit 8a91b60

2 files changed

Lines changed: 19 additions & 56 deletions

File tree

lib/database/repositories/QcFlagRepository.js

Lines changed: 19 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ class QcFlagRepository extends Repository {
113113
gaq_periods.data_pass_id,
114114
gaq_periods.run_number,
115115
gaq_periods.coverage_ratio,
116-
<<<<<<< HEAD
117116
IF(
118117
COUNT(DISTINCT qcf.id) = COUNT( DISTINCT gaqd.detector_id),
119118
qc_flag_block_significance(qcft.bad, qcft.monte_carlo_reproducible),
@@ -142,32 +141,6 @@ class QcFlagRepository extends Repository {
142141
AND (qcfep.from IS NULL OR qcfep.\`from\` < gaq_periods.\`to\`)
143142
AND (qcfep.to IS NULL OR qcfep.\`to\` > gaq_periods.\`from\`)
144143
145-
=======
146-
IF(COUNT(DISTINCT qcf.id) > 0, qc_flag_block_significance(qcft.bad, qcft.monte_carlo_reproducible), NULL) AS significance,
147-
GROUP_CONCAT( DISTINCT qcfv.flag_id ) AS verified_flags_list,
148-
GROUP_CONCAT( DISTINCT qcfep.flag_id ) AS flags_list
149-
150-
FROM gaq_periods
151-
152-
INNER JOIN global_aggregated_quality_detectors AS gaqd
153-
ON gaqd.data_pass_id = gaq_periods.data_pass_id
154-
AND gaqd.run_number = gaq_periods.run_number
155-
156-
LEFT JOIN (
157-
data_pass_quality_control_flag AS dpqcf
158-
INNER JOIN quality_control_flags AS qcf ON dpqcf.quality_control_flag_id = qcf.id
159-
INNER JOIN quality_control_flag_types AS qcft ON qcft.id = qcf.flag_type_id
160-
INNER JOIN quality_control_flag_effective_periods AS qcfep ON qcf.id = qcfep.flag_id
161-
LEFT JOIN quality_control_flag_verifications AS qcfv ON qcfv.flag_id = qcf.id
162-
)
163-
ON gaq_periods.data_pass_id = dpqcf.data_pass_id
164-
AND qcf.run_number = gaq_periods.run_number
165-
AND gaqd.detector_id = qcf.detector_id
166-
AND gaq_periods.run_number = qcf.run_number
167-
AND (qcfep.from IS NULL OR qcfep.\`from\` < gaq_periods.\`to\`)
168-
AND (qcfep.to IS NULL OR qcfep.\`to\` > gaq_periods.\`from\`)
169-
170-
>>>>>>> main
171144
WHERE gaq_periods.data_pass_id = :dataPassId
172145
GROUP BY gaq_periods.data_pass_id, gaq_periods.run_number, gaq_periods.\`from\`, gaq_periods.to
173146
`;
@@ -187,27 +160,25 @@ class QcFlagRepository extends Repository {
187160
GROUP BY gaq.data_pass_id, gaq.run_number;
188161
`;
189162
const [rows] = await this.model.sequelize.query(summaryQuery, { replacements: { dataPassId } });
190-
const entries = rows.map(
191-
({
192-
run_number,
193-
bad_coverage,
194-
mcr_coverage,
195-
good_coverage,
196-
flags_list,
197-
verifiedd_flags_list,
198-
undefined_quality_periods_count,
199-
}) => [
200-
run_number,
201-
{
202-
badCoverage: parseFloat(bad_coverage ?? '0'),
203-
mcReproducibleCoverage: parseFloat(mcr_coverage ?? '0'),
204-
goodCoverage: parseFloat(good_coverage ?? '0'),
205-
flagsIds: [...new Set(flags_list?.split(','))],
206-
verifiedFlagsIds: [...new Set(verifiedd_flags_list?.split(','))],
207-
undefinedQualityPeriodsCount: undefined_quality_periods_count,
208-
},
209-
],
210-
);
163+
const entries = rows.map(({
164+
run_number,
165+
bad_coverage,
166+
mcr_coverage,
167+
good_coverage,
168+
flags_list,
169+
verifiedd_flags_list,
170+
undefined_quality_periods_count,
171+
}) => [
172+
run_number,
173+
{
174+
badCoverage: parseFloat(bad_coverage ?? '0'),
175+
mcReproducibleCoverage: parseFloat(mcr_coverage ?? '0'),
176+
goodCoverage: parseFloat(good_coverage ?? '0'),
177+
flagsIds: [...new Set(flags_list?.split(','))],
178+
verifiedFlagsIds: [...new Set(verifiedd_flags_list?.split(','))],
179+
undefinedQualityPeriodsCount: undefined_quality_periods_count,
180+
},
181+
]);
211182

212183
return Object.fromEntries(entries);
213184
}

test/lib/server/services/qualityControlFlag/QcFlagService.test.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,7 @@ module.exports = () => {
372372
);
373373
});
374374

375-
<<<<<<< HEAD
376-
it.skip('should fail to create quality control flag because qc flag `from` timestamp is smaller than run.startTime', async () => {
377-
=======
378375
it('should return empty when creating quality control flag because `from` timestamp is smaller than run.startTime', async () => {
379-
>>>>>>> main
380376
const period = {
381377
from: new Date('2019-08-08 11:36:40').getTime(),
382378
to: new Date('2019-08-09 05:40:00').getTime(),
@@ -400,11 +396,7 @@ module.exports = () => {
400396
assert.strictEqual(response.length, 0, 'Response should be empty array');
401397
});
402398

403-
<<<<<<< HEAD
404-
it.skip('should fail to create quality control flag because qc flag `from` timestamp is greater than `to` timestamp', async () => {
405-
=======
406399
it('should return empty when creating quality control flag because `from` timestamp is greater than `to` timestamp', async () => {
407-
>>>>>>> main
408400
const qcFlag = {
409401
from: new Date('2019-08-09 04:16:40').getTime(), // Failing property
410402
to: new Date('2019-08-08 21:20:00').getTime(), // Failing property

0 commit comments

Comments
 (0)