-
Notifications
You must be signed in to change notification settings - Fork 23
[O2B-1463] Refactor logic of detector fetching for RCT and hide legacy detector for periods passes 25 onwards #2211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
graduta
merged 11 commits into
main
from
feature/O2B-1463/hide-legacy-detector-for-periods-passes-25-onwards
Aug 11, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d45c735
Extract detectors functionality in parent class
graduta ac38591
Add util function to filter out old detectors if needed
graduta a6c21a7
Use the new function to filter out detectors depending on the pass or…
graduta 253b46c
Fix eslint issue
graduta b3820d4
Move util function in utilities of front-end rather than back-end
graduta eee38a2
Fix lint issue
graduta 8858511
Do not early trigger the loading and instead wait for child class
graduta 711a451
Fix way of importing test
graduta 2e72c2d
Use window.model reference instead of direct model
graduta f634769
Add safe-check function for test
graduta fa5f6d5
Improve reliability of the test
graduta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
lib/public/utilities/filterOutLegacyDetectorsForNewerPeriods.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE O2. This software is | ||
| * distributed under the terms of the GNU General Public License v3 (GPL | ||
| * Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| const LEGACY_DETECTOR_NAMES_FOR_AFTER_25 = ['CPV', 'PHS']; | ||
|
|
||
| /** | ||
| * Remove legacy detectors for newer LHC periods/passes (after LHC25) from the list of detectors. | ||
| * | ||
| * @param {Detector[]} detectors detectors to filter | ||
| * @param {string} [label=''] name of the period or data pass | ||
| * @return {Detector[]} filtered detectors | ||
| */ | ||
| const filterOutLegacyDetectorsForNewerPeriods = (detectors = [], label = '') => { | ||
| const shouldFilterOutLegacyDetectors = /LHC(2[5-9]|[3-9]\d)/.test(label ?? ''); | ||
|
|
||
| return detectors.filter(({ name }) => !shouldFilterOutLegacyDetectors || !LEGACY_DETECTOR_NAMES_FOR_AFTER_25.includes(name)); | ||
| }; | ||
|
|
||
| export { filterOutLegacyDetectorsForNewerPeriods }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
test/lib/public/utilities/filterOutLegacyDetectorsForNewerPeriods.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE O2. This software is | ||
| * distributed under the terms of the GNU General Public License v3 (GPL | ||
| * Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| const { expect } = require('chai'); | ||
|
|
||
| module.exports = () => { | ||
| it('should filter legacy detectors for newer periods', async () => { | ||
| const { filterOutLegacyDetectorsForNewerPeriods } = await import('../../../../lib/public/utilities/filterOutLegacyDetectorsForNewerPeriods.js'); | ||
| const detectors = [{ name: 'CPV' }, { name: 'PHS' }, { name: 'ITS' }]; | ||
|
|
||
| expect(filterOutLegacyDetectorsForNewerPeriods(detectors, 'LHC25ab')).to.deep.equal([{ name: 'ITS' }]); | ||
| expect(filterOutLegacyDetectorsForNewerPeriods(detectors, 'LHC26ad_cpass1_residuals')).to.deep.equal([{ name: 'ITS' }]); | ||
| expect(filterOutLegacyDetectorsForNewerPeriods(detectors, 'LHC24')).to.deep.equal(detectors); | ||
| expect(filterOutLegacyDetectorsForNewerPeriods(detectors, '')).to.deep.equal(detectors); | ||
| }); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.