Skip to content

Commit 161dfae

Browse files
authored
[O2B-1471] Remove unnecessary PdpBeamType parameter from url (#1958)
* fixes, refactor * rename * rename * renames * fix * fix * fix * fix * fix * fix * fix * add ppBeamTypes to front links and fix set method * fix * rm unncessary param * rm pdpBeamType * use lhc period Id * mv from another b * cleanup * typo * cleanup * fix * fix
1 parent d3eccf0 commit 161dfae

33 files changed

Lines changed: 170 additions & 112 deletions

lib/database/adapters/DataPassAdapter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ class DataPassAdapter {
4040

4141
const runsCount = databaseObject.get('runsCount');
4242
const simulationPassesCount = databaseObject.get('simulationPassesCount');
43-
const pdpBeamType = databaseObject.get('pdpBeamType');
43+
const pdpBeamTypes = databaseObject.get('pdpBeamTypes')?.split(',') || [];
4444

4545
return {
4646
id,
4747
name,
4848
skimmingStage,
4949
versions: (versions ?? []).map(this.dataPassVersionAdapter.toEntity),
50-
pdpBeamType,
50+
pdpBeamTypes,
5151
runsCount,
5252
simulationPassesCount,
5353
isFrozen,

lib/database/adapters/LhcPeriodStatisticsAdapter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LhcPeriodStatisticsAdapter {
3434

3535
const runsCount = databaseObject.get('runsCount');
3636
const distinctEnergies = databaseObject.get('distinctEnergies')?.split(',').map((energy) => parseFloat(energy)) || [];
37-
const beamTypes = databaseObject.get('beamTypes')?.split(',') || [];
37+
const pdpBeamTypes = databaseObject.get('pdpBeamTypes')?.split(',') || [];
3838
const dataPassesCount = databaseObject.get('dataPassesCount');
3939
const simulationPassesCount = databaseObject.get('simulationPassesCount');
4040

@@ -43,7 +43,7 @@ class LhcPeriodStatisticsAdapter {
4343
avgCenterOfMassEnergy,
4444
runsCount,
4545
distinctEnergies,
46-
beamTypes,
46+
pdpBeamTypes,
4747
dataPassesCount,
4848
simulationPassesCount,
4949
lhcPeriod: lhcPeriod ? this.lhcPeriodAdapter.toEntity(lhcPeriod) : null,

lib/database/adapters/SimulationPassAdapter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class SimulationPassAdapter {
4242

4343
const dataPassesCount = databaseObject.get('dataPassesCount');
4444
const runsCount = databaseObject.get('runsCount');
45+
const pdpBeamTypes = databaseObject.get('pdpBeamTypes')?.split(',') || [];
4546

4647
return {
4748
id,
@@ -54,6 +55,7 @@ class SimulationPassAdapter {
5455
outputSize,
5556
runsCount,
5657
dataPassesCount,
58+
pdpBeamTypes,
5759
};
5860
}
5961
}

lib/database/models/typedefs/SequelizeLhcPeriodStatistics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @property {number} id
1818
* @property {number|null} avgCenterOfMassEnergy
1919
* @property {number[]} distinctEnergies
20-
* @property {string[]} beamTypes
20+
* @property {string[]} pdpBeamTypes
2121
* @property {number} runsCount
2222
* @property {number} dataPassesCount
2323
* @property {number} simulationPassesCount

lib/domain/entities/LhcPeriodStatistics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @property {number} id
1818
* @property {LhcPeriod} lhcPeriod
1919
* @property {number[]|null} distinctEnergies
20-
* @property {string[]} beamTypes
20+
* @property {string[]} pdpBeamTypes
2121
* @property {number} runsCount
2222
* @property {number} dataPassesCount
2323
* @property {number} simulationPassesCount

lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ export const dataPassesActiveColumns = {
4646
associatedRuns: {
4747
name: 'Runs',
4848
visible: true,
49-
format: (_, { id, runsCount, pdpBeamType }) =>
49+
format: (_, { id, runsCount }) =>
5050
runsCount === 0
5151
? 'No runs'
5252
: frontLink(
5353
badge(runsCount),
5454
'runs-per-data-pass',
55-
{ dataPassId: id, pdpBeamType },
55+
{ dataPassId: id },
5656
),
5757
classes: 'w-10',
5858
},

lib/public/views/QcFlags/QcFlagsModel.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ export class QcFlagsModel extends Observable {
9595
/**
9696
* Load the creation for data pass page model
9797
*
98-
* @param {Object} params - Parameters for the method
99-
* @param {number} params.dataPassId - The data pass ID
100-
* @param {string} [params.runNumberDetectorsMap] - String representation of run number to detector map
98+
* @param {Object} parameters - Parameters for the method
99+
* @param {number} parameters.dataPassId - The data pass ID
100+
* @param {string} parameters.runNumberDetectorsMap - String representation of run number to detector map
101101
* @returns {void}
102102
*/
103103
loadCreationForDataPass({ dataPassId, runNumberDetectorsMap }) {
@@ -190,7 +190,7 @@ export class QcFlagsModel extends Observable {
190190
* Load the creation for simulation pass page model
191191
* @param {object} parameters parameters for the model
192192
* @param {number} parameters.simulationPassId - The simulation pass ID
193-
* @param {string} [parameters.runNumberDetectorsMap] - String representation of run number to detector map
193+
* @param {string} parameters.runNumberDetectorsMap - String representation of run number to detector map
194194
* @returns {void}
195195
*/
196196
loadCreationForSimulationPass({ simulationPassId, runNumberDetectorsMap }) {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @license
3+
* Copyright CERN and copyright holders of ALICE O2. This software is
4+
* distributed under the terms of the GNU General Public License v3 (GPL
5+
* Version 3), copied verbatim in the file "COPYING".
6+
*
7+
* See http://alice-o2.web.cern.ch/license for full licensing information.
8+
*
9+
* In applying this license CERN does not waive the privileges and immunities
10+
* granted to it by virtue of its status as an Intergovernmental Organization
11+
* or submit itself to any jurisdiction.
12+
*/
13+
14+
import { PdpBeamType } from '../../../domain/enums/PdpBeamType.js';
15+
import { inelasticInteractionRateActiveColumnsForPbPb as inelForPbPb } from './inelasticInteractionRateActiveColumnsForPbPb.js';
16+
import { inelasticInteractionRateActiveColumnsForProtonProton as inelForPP } from './inelasticInteractionRateActiveColumnsForProtonProton.js';
17+
18+
/**
19+
* Get appropriate runs' activate columns dependent on their pdp beam types
20+
*
21+
* @param {string[]} pdpBeamTypes lit of pdp beam types
22+
* @return {ActiveColumn} active column
23+
*/
24+
export const getInelasticInteractionRateColumns = (pdpBeamTypes) => ({
25+
...pdpBeamTypes?.includes(PdpBeamType.LEAD_LEAD) ? inelForPbPb : {},
26+
...pdpBeamTypes?.includes(PdpBeamType.PROTON_PROTON) ? inelForPP : {},
27+
});

lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,26 @@ export class FixedPdpBeamTypeRunsOverviewModel extends RunsWithQcModel {
2626
*/
2727
constructor(model) {
2828
super(model);
29-
30-
this._pdpBeamType = null;
29+
this._pdpBeamTypes = [];
3130
}
3231

3332
/**
3433
* Get pdp_beam_type of fetched runs
3534
*
36-
* @return {string} beam type
35+
* @return {string[]} beam type
3736
*/
3837
get pdpBeamTypes() {
39-
return this._pdpBeamType;
38+
return this._pdpBeamTypes;
4039
}
4140

4241
/**
4342
* Set pdp_beam_type of fetched runs
4443
*
45-
* @param {string} pdpBeamType beam type
44+
* @param {string|string[]|null} pdpBeamTypes beam type, nullish values are ignored
4645
*/
47-
set pdpBeamTypes(pdpBeamType) {
48-
this._pdpBeamType = pdpBeamType;
46+
setPdpBeamTypes(pdpBeamTypes) {
47+
if (pdpBeamTypes) {
48+
this._pdpBeamTypes = typeof pdpBeamTypes === 'string' ? pdpBeamTypes.split(',') : pdpBeamTypes;
49+
}
4950
}
5051
}

lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,16 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
122122

123123
this._fetchQcSummary();
124124
this._fetchGaqSummary();
125-
await this._fetchDataPass();
126-
this._dataPass$.getCurrent().match({
127-
Success: ({ skimmingStage }) => skimmingStage === SkimmingStage.SKIMMABLE && this._fetchSkimmableRuns(),
128-
Other: () => null,
129-
});
125+
await this._fetchDataPass().then(() =>
126+
this._dataPass$.getCurrent().match({
127+
Success: ({ skimmingStage, pdpBeamTypes }) => {
128+
if (skimmingStage === SkimmingStage.SKIMMABLE) {
129+
this._fetchSkimmableRuns();
130+
}
131+
this.setPdpBeamTypes(pdpBeamTypes);
132+
},
133+
Other: () => null,
134+
}));
130135
super.load();
131136
}
132137

0 commit comments

Comments
 (0)