Skip to content

Commit

Permalink
[OGUI-1431] Fix run retrieval based on new filters (#2180)
Browse files Browse the repository at this point in the history
* updates the RunSummaryAdapter to also keep `runDuration` and `id` of the run to be used later in front-end
* updates the way in which the RunServices passes parameters to BookkeepingService
  • Loading branch information
graduta authored Oct 27, 2023
1 parent 4d854eb commit d6aa554
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Control/lib/adapters/RunSummaryAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ class RunSummaryAdapter {
*/
static toEntity(run) {
const {
id,
runNumber,
environmentId,
definition,
calibrationStatus,
runType,
runDuration,
startTime,
endTime,
} = run;
Expand All @@ -45,11 +47,13 @@ class RunSummaryAdapter {
detectors.sort();

return {
id,
runNumber,
environmentId,
definition,
calibrationStatus,
runType: runType?.name,
runDuration,
startTime,
detectors,
endTime,
Expand Down
6 changes: 5 additions & 1 deletion Control/lib/services/Run.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ class RunService {
calibrationRunsPerDetector[detector] = [];
for (const calibrationConfiguration of calibrationConfigurationList) {
const runTypeId = this._runTypes[calibrationConfiguration.runType];
const runInfo = await this._bkpService.getRun(RUN_DEFINITIONS.CALIBRATION, runTypeId, detector);
const runInfo = await this._bkpService.getRun({
definitions: RUN_DEFINITIONS.CALIBRATION,
runTypes: runTypeId,
detectors: detector
});
if (runInfo) {
calibrationRunsPerDetector[detector].push(runInfo);
}
Expand Down
2 changes: 2 additions & 0 deletions Control/lib/typedefs/RunSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
* RunSummary is an object which contains just a summary of an entire run entity: https://github.com/AliceO2Group/Bookkeeping/blob/main/lib/domain/entities/Run.js
*
* @property {Number} runNumber
* @property {Number} id
* @property {String} environmentId
* @property {String} definition
* @property {String} calibrationStatus
* @property {String} runType
* @property {Number} runDuration
* @property {Number} startTime
* @property {Number} endTime
* @property {Array<String>} detectors
Expand Down
2 changes: 2 additions & 0 deletions Control/test/lib/services/mocha-bookkeeping.service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ describe('BookkeepingService test suite', () => {

describe(`'getRun' test suite`, async () => {
let runToReturn = {
id: 123,
runNumber: 123,
runDuration: 100,
environmentId: 'abc',
definition: 'CALIBRATION',
calibrationStatus: 'good',
Expand Down
12 changes: 6 additions & 6 deletions Control/test/lib/services/mocha-run.service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ describe(`'RunService' test suite`, async () => {

it('should return an object with calibration runs grouped by detector', async () => {
const getRun = sinon.stub();
getRun.withArgs(RUN_DEFINITIONS.CALIBRATION, 0, 'TPC').resolves({runNumber: 1});
getRun.withArgs(RUN_DEFINITIONS.CALIBRATION, 1, 'TPC').resolves({runNumber: 2});
getRun.withArgs(RUN_DEFINITIONS.CALIBRATION, 2, 'ABC').resolves({runNumber: 3});
getRun.withArgs(RUN_DEFINITIONS.CALIBRATION, 1, 'ABC').resolves({runNumber: 4});
getRun.withArgs(RUN_DEFINITIONS.CALIBRATION, 1, 'XYZ').resolves(undefined);
getRun.withArgs({definitions: RUN_DEFINITIONS.CALIBRATION, runTypes: 0, detectors: 'TPC'}).resolves({runNumber: 1});
getRun.withArgs({definitions: RUN_DEFINITIONS.CALIBRATION, runTypes: 1, detectors: 'TPC'}).resolves({runNumber: 2});
getRun.withArgs({definitions: RUN_DEFINITIONS.CALIBRATION, runTypes: 2, detectors: 'ABC'}).resolves({runNumber: 3});
getRun.withArgs({definitions: RUN_DEFINITIONS.CALIBRATION, runTypes: 1, detectors: 'ABC'}).resolves({runNumber: 4});
getRun.withArgs({definitions: RUN_DEFINITIONS.CALIBRATION, runTypes: 1, detectors: 'XYZ'}).resolves(undefined);

const runSrv = new RunService({getRun}, {});
runSrv._runTypes = {
Expand All @@ -83,7 +83,7 @@ describe(`'RunService' test suite`, async () => {
{runType: 'NOISE', configuration: 'cpv-noise', label: 'CPV NOISE'},
{runType: 'PULSE', configuration: 'cpv-pulse', label: 'CPV PULSE'},
],
ABC: [
ABC: [
{runType: 'SOMEOTHER', configuration: 'abc-someother', label: 'ABC SOME OTHER'},
],
XYZ: [
Expand Down

0 comments on commit d6aa554

Please sign in to comment.