Skip to content

Commit d01154d

Browse files
committed
refactor(api): remove variationPercentUntil parameter from flash algorithm
1 parent dd10148 commit d01154d

File tree

24 files changed

+77
-281
lines changed

24 files changed

+77
-281
lines changed

admin/app/components/administration/certification/flash-algorithm-configuration/form.gjs

-12
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@ import { t } from 'ember-intl';
4040
<:label>{{t "pages.administration.certification.flash-algorithm-configuration.form.variationPercent"}}</:label>
4141
</PixInput>
4242

43-
<PixInput
44-
{{on "input" @updateNumberValues}}
45-
@id="variationPercentUntil"
46-
@value={{@form.variationPercentUntil}}
47-
type="number"
48-
min="0"
49-
>
50-
<:label>{{t
51-
"pages.administration.certification.flash-algorithm-configuration.form.variationPercentUntil"
52-
}}</:label>
53-
</PixInput>
54-
5543
<PixCheckbox
5644
{{on "input" @updateCheckboxValues}}
5745
@id="limitToOneQuestionPerTube"

admin/app/components/administration/certification/flash-algorithm-configuration/index.gjs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export default class FlashAlgorithmConfiguration extends Component {
1414
maximumAssessmentLength: this.args.model.maximumAssessmentLength,
1515
challengesBetweenSameCompetence: this.args.model.challengesBetweenSameCompetence,
1616
variationPercent: this.args.model.variationPercent,
17-
variationPercentUntil: this.args.model.variationPercentUntil,
1817
limitToOneQuestionPerTube: this.args.model.limitToOneQuestionPerTube,
1918
enablePassageByAllCompetences: this.args.model.enablePassageByAllCompetences,
2019
};

admin/app/models/flash-algorithm-configuration.js

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export default class FlashAlgorithmConfiguration extends Model {
44
@attr('number') maximumAssessmentLength;
55
@attr('number') challengesBetweenSameCompetence;
66
@attr('number') variationPercent;
7-
@attr('number') variationPercentUntil;
87
@attr('boolean') limitToOneQuestionPerTube;
98
@attr('boolean') enablePassageByAllCompetences;
109
}

admin/tests/integration/components/administration/certification/flash-algorithm-configuration_test.gjs

-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module('Integration | Component | administration/certification/flash-algorithm-
1313
maximumAssessmentLength: 1,
1414
challengesBetweenSameCompetence: 3,
1515
variationPercent: 4,
16-
variationPercentUntil: 5,
1716
limitToOneQuestionPerTube: true,
1817
enablePassageByAllCompetences: false,
1918
};
@@ -33,9 +32,6 @@ module('Integration | Component | administration/certification/flash-algorithm-
3332
const variationPercent = await screen.getByRole('spinbutton', {
3433
name: t('pages.administration.certification.flash-algorithm-configuration.form.variationPercent'),
3534
}).value;
36-
const variationPercentUntil = await screen.getByRole('spinbutton', {
37-
name: t('pages.administration.certification.flash-algorithm-configuration.form.variationPercentUntil'),
38-
}).value;
3935
const limitToOneQuestionPerTube = await screen.getByRole('checkbox', {
4036
name: t('pages.administration.certification.flash-algorithm-configuration.form.limitToOneQuestionPerTube'),
4137
}).checked;
@@ -46,7 +42,6 @@ module('Integration | Component | administration/certification/flash-algorithm-
4642
assert.strictEqual(maximumAssessmentLength, '1');
4743
assert.strictEqual(challengesBetweenSameCompetence, '3');
4844
assert.strictEqual(variationPercent, '4');
49-
assert.strictEqual(variationPercentUntil, '5');
5045
assert.true(limitToOneQuestionPerTube);
5146
assert.false(enablePassageByAllCompetences);
5247
});

admin/tests/unit/components/administration/certification/flash-algorithm-configuration-test.js

-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ module('Unit | Component | authenticated/certifications/flash-algorithm-configur
3030
maximumAssessmentLength: 0,
3131
challengesBetweenSameCompetence: 2,
3232
variationPercent: 3,
33-
variationPercentUntil: 4,
3433
limitToOneQuestionPerTube: true,
3534
enablePassageByAllCompetences: true,
3635
};
@@ -72,7 +71,6 @@ module('Unit | Component | authenticated/certifications/flash-algorithm-configur
7271
maximumAssessmentLength: 0,
7372
challengesBetweenSameCompetence: 2,
7473
variationPercent: 3,
75-
variationPercentUntil: 4,
7674
limitToOneQuestionPerTube: true,
7775
enablePassageByAllCompetences: true,
7876
};

admin/translations/en.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,7 @@
405405
"enablePassageByAllCompetences": "Forcer le passage par les 16 compétences",
406406
"limitToOneQuestionPerTube": "Limiter à une question par sujet",
407407
"maximumAssessmentLength": "Nombre de questions",
408-
"variationPercent": "Capage de la capacité (en % )",
409-
"variationPercentUntil": "Nombre de questions pour le capage de la capacité"
408+
"variationPercent": "Capage de la capacité (en % )"
410409
}
411410
},
412411
"sco-whitelist": {

admin/translations/fr.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,7 @@
415415
"enablePassageByAllCompetences": "Forcer le passage par les 16 compétences",
416416
"limitToOneQuestionPerTube": "Limiter à une question par sujet",
417417
"maximumAssessmentLength": "Nombre de questions",
418-
"variationPercent": "Capage de la capacité (en % )",
419-
"variationPercentUntil": "Nombre de questions pour le capage de la capacité"
418+
"variationPercent": "Capage de la capacité (en % )"
420419
}
421420
},
422421
"sco-whitelist": {

api/db/database-builder/factory/build-flash-algorithm-configuration.js

-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const buildFlashAlgorithmConfiguration = function ({
77
limitToOneQuestionPerTube = null,
88
enablePassageByAllCompetences = false,
99
variationPercent = null,
10-
variationPercentUntil = null,
1110
createdAt = new Date(),
1211
} = {}) {
1312
const values = {
@@ -16,7 +15,6 @@ const buildFlashAlgorithmConfiguration = function ({
1615
limitToOneQuestionPerTube,
1716
enablePassageByAllCompetences,
1817
variationPercent,
19-
variationPercentUntil,
2018
createdAt,
2119
};
2220

api/db/seeds/data/team-certification/data-builder.js

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ function _createV3CertificationConfiguration({ databaseBuilder }) {
123123
limitToOneQuestionPerTube: true,
124124
enablePassageByAllCompetences: true,
125125
variationPercent: 0.5,
126-
variationPercentUntil: null,
127126
createdAt: new Date('1977-10-19'),
128127
});
129128
}

api/src/certification/flash-certification/application/flash-assessment-configuration-route.js

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const register = async (server) => {
4040
limitToOneQuestionPerTube: Joi.boolean().optional(),
4141
enablePassageByAllCompetences: Joi.boolean().optional(),
4242
variationPercent: Joi.number().min(0).max(1).allow(null).optional(),
43-
variationPercentUntil: Joi.number().min(0).allow(null).optional(),
4443
}),
4544
},
4645
handler: flashAssessmentConfigurationController.createFlashAssessmentConfiguration,

api/src/certification/flash-certification/domain/models/FlashAssessmentAlgorithm.js

-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ class FlashAssessmentAlgorithm {
8989
challenges,
9090
capacity: initialCapacity,
9191
variationPercent: this._configuration.variationPercent,
92-
variationPercentUntil: this._configuration.variationPercentUntil,
9392
});
9493
}
9594

@@ -103,7 +102,6 @@ class FlashAssessmentAlgorithm {
103102
challenges,
104103
capacity: initialCapacity,
105104
variationPercent: this._configuration.variationPercent,
106-
variationPercentUntil: this._configuration.variationPercentUntil,
107105
});
108106
}
109107

api/src/certification/flash-certification/domain/services/algorithm-methods/flash.js

+3-29
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ function getPossibleNextChallenges({
4343
return _findBestPossibleChallenges(challengesWithReward, minimalSuccessRate, capacity);
4444
}
4545

46-
function getCapacityAndErrorRate({
47-
allAnswers,
48-
challenges,
49-
capacity = DEFAULT_CAPACITY,
50-
variationPercent,
51-
variationPercentUntil,
52-
}) {
46+
function getCapacityAndErrorRate({ allAnswers, challenges, capacity = DEFAULT_CAPACITY, variationPercent }) {
5347
if (allAnswers.length === 0) {
5448
return { capacity, errorRate: DEFAULT_ERROR_RATE };
5549
}
@@ -59,19 +53,12 @@ function getCapacityAndErrorRate({
5953
challenges,
6054
capacity,
6155
variationPercent,
62-
variationPercentUntil,
6356
});
6457

6558
return capacityHistory.at(-1);
6659
}
6760

68-
function getCapacityAndErrorRateHistory({
69-
allAnswers,
70-
challenges,
71-
capacity = DEFAULT_CAPACITY,
72-
variationPercent,
73-
variationPercentUntil,
74-
}) {
61+
function getCapacityAndErrorRateHistory({ allAnswers, challenges, capacity = DEFAULT_CAPACITY, variationPercent }) {
7562
let latestCapacity = capacity;
7663

7764
let likelihood = samples.map(() => DEFAULT_PROBABILITY_TO_ANSWER);
@@ -83,19 +70,14 @@ function getCapacityAndErrorRateHistory({
8370

8471
while (answerIndex < allAnswers.length) {
8572
answer = allAnswers[answerIndex];
86-
const variationPercentForCurrentAnswer = _defineVariationPercentForCurrentAnswer(
87-
variationPercent,
88-
variationPercentUntil,
89-
answerIndex,
90-
);
9173

9274
({ latestCapacity, likelihood, normalizedPosteriori } = _singleMeasure({
9375
challenges,
9476
answer,
9577
latestCapacity,
9678
likelihood,
9779
normalizedPosteriori,
98-
variationPercent: variationPercentForCurrentAnswer,
80+
variationPercent,
9981
}));
10082

10183
answerIndex++;
@@ -110,14 +92,6 @@ function getCapacityAndErrorRateHistory({
11092
return capacityHistory;
11193
}
11294

113-
function _defineVariationPercentForCurrentAnswer(variationPercent, variationPercentUntil, answerIndex) {
114-
if (!variationPercentUntil) {
115-
return variationPercent;
116-
}
117-
118-
return variationPercentUntil >= answerIndex ? variationPercent : undefined;
119-
}
120-
12195
function _singleMeasure({ challenges, answer, latestCapacity, likelihood, normalizedPosteriori, variationPercent }) {
12296
const answeredChallenge = _findChallengeForAnswer(challenges, answer);
12397

api/src/certification/flash-certification/infrastructure/serializers/flash-algorithm-configuration-serializer.js

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const serialize = function ({ flashAlgorithmConfiguration }) {
99
'limitToOneQuestionPerTube',
1010
'enablePassageByAllCompetences',
1111
'variationPercent',
12-
'variationPercentUntil',
1312
];
1413
return new Serializer('flash-algorithm-configurations', {
1514
transform(config) {

api/src/certification/shared/domain/models/FlashAssessmentAlgorithmConfiguration.js

-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { config } from '../../../../shared/config.js';
77
* @param flashImplementation - the flash algorithm implementation
88
* @param enablePassageByAllCompetences - enable or disable the passage through all competences
99
* @param variationPercent - maximum variation of estimated level between two answers
10-
* @param variationPercentUntil - maximum variation of estimated level between two answers for a specified number of challenges
1110
*/
1211
export class FlashAssessmentAlgorithmConfiguration {
1312
constructor({
@@ -16,15 +15,13 @@ export class FlashAssessmentAlgorithmConfiguration {
1615
limitToOneQuestionPerTube = false,
1716
enablePassageByAllCompetences = false,
1817
variationPercent,
19-
variationPercentUntil,
2018
createdAt,
2119
} = {}) {
2220
this.maximumAssessmentLength = maximumAssessmentLength;
2321
this.challengesBetweenSameCompetence = challengesBetweenSameCompetence;
2422
this.limitToOneQuestionPerTube = limitToOneQuestionPerTube;
2523
this.enablePassageByAllCompetences = enablePassageByAllCompetences;
2624
this.variationPercent = variationPercent;
27-
this.variationPercentUntil = variationPercentUntil;
2825
this.createdAt = createdAt;
2926
}
3027

@@ -35,7 +32,6 @@ export class FlashAssessmentAlgorithmConfiguration {
3532
limitToOneQuestionPerTube: this.limitToOneQuestionPerTube,
3633
enablePassageByAllCompetences: this.enablePassageByAllCompetences,
3734
variationPercent: this.variationPercent,
38-
variationPercentUntil: this.variationPercentUntil,
3935
createdAt: this.createdAt,
4036
};
4137
}
@@ -46,7 +42,6 @@ export class FlashAssessmentAlgorithmConfiguration {
4642
limitToOneQuestionPerTube,
4743
enablePassageByAllCompetences,
4844
variationPercent,
49-
variationPercentUntil,
5045
createdAt,
5146
}) {
5247
return new FlashAssessmentAlgorithmConfiguration({
@@ -55,7 +50,6 @@ export class FlashAssessmentAlgorithmConfiguration {
5550
limitToOneQuestionPerTube,
5651
enablePassageByAllCompetences,
5752
variationPercent,
58-
variationPercentUntil,
5953
createdAt,
6054
});
6155
}

0 commit comments

Comments
 (0)