Skip to content

Commit 62a9c2e

Browse files
committed
refactor(api): remove unused options param from getPossibleNextChallenges
1 parent 1817e45 commit 62a9c2e

File tree

5 files changed

+5
-27
lines changed

5 files changed

+5
-27
lines changed

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

-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ class FlashAssessmentAlgorithm {
5757
return this.flashAlgorithmImplementation.getPossibleNextChallenges({
5858
availableChallenges: challengesAfterRulesApplication,
5959
capacity,
60-
options: {
61-
challengesBetweenSameCompetence: this._configuration.challengesBetweenSameCompetence,
62-
minimalSuccessRate: 0,
63-
},
6460
});
6561
}
6662

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

+5-8
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ export {
2424
getReward,
2525
};
2626

27-
function getPossibleNextChallenges({
28-
availableChallenges,
29-
capacity = DEFAULT_CAPACITY,
30-
options: { minimalSuccessRate = 0 } = {},
31-
} = {}) {
27+
function getPossibleNextChallenges({ availableChallenges, capacity = DEFAULT_CAPACITY } = {}) {
3228
const challengesWithReward = availableChallenges.map((challenge) => {
3329
return {
3430
challenge,
@@ -40,7 +36,7 @@ function getPossibleNextChallenges({
4036
};
4137
});
4238

43-
return _findBestPossibleChallenges(challengesWithReward, minimalSuccessRate, capacity);
39+
return _findBestPossibleChallenges(challengesWithReward, capacity);
4440
}
4541

4642
function getCapacityAndErrorRate({ allAnswers, challenges, capacity = DEFAULT_CAPACITY, variationPercent }) {
@@ -177,11 +173,12 @@ function _limitCapacityVariation(previousCapacity, nextCapacity, variationPercen
177173
: Math.max(nextCapacity, previousCapacity - gap);
178174
}
179175

180-
function _findBestPossibleChallenges(challengesWithReward, minimumSuccessRate, capacity) {
176+
function _findBestPossibleChallenges(challengesWithReward, capacity) {
181177
const hasMinimumSuccessRate = ({ challenge }) => {
178+
const MINIMUM_SUCCESS_RATE = 0;
182179
const successProbability = _getProbability(capacity, challenge.discriminant, challenge.difficulty);
183180

184-
return successProbability >= minimumSuccessRate;
181+
return successProbability >= MINIMUM_SUCCESS_RATE;
185182
};
186183

187184
const orderedChallengesWithReward = orderBy(

api/tests/certification/evaluation/unit/domain/usecases/get-next-challenge_test.js

-6
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ describe('Unit | Domain | Use Cases | get-next-challenge', function () {
110110
.withArgs({
111111
availableChallenges: [nextChallengeToAnswer],
112112
capacity: 0,
113-
options: sinon.match.any,
114113
})
115114
.returns([nextChallengeToAnswer]);
116115

@@ -200,7 +199,6 @@ describe('Unit | Domain | Use Cases | get-next-challenge', function () {
200199
.withArgs({
201200
availableChallenges: [nextChallengeToAnswer, accessibleChallenge],
202201
capacity: 0,
203-
options: sinon.match.any,
204202
})
205203
.returns([nextChallengeToAnswer]);
206204

@@ -358,7 +356,6 @@ describe('Unit | Domain | Use Cases | get-next-challenge', function () {
358356
.withArgs({
359357
availableChallenges: [nextChallengeToAnswer],
360358
capacity: 0,
361-
options: sinon.match.any,
362359
})
363360
.returns([nextChallengeToAnswer]);
364361

@@ -440,7 +437,6 @@ describe('Unit | Domain | Use Cases | get-next-challenge', function () {
440437
.withArgs({
441438
availableChallenges: [nextChallenge],
442439
capacity: 0,
443-
options: sinon.match.any,
444440
})
445441
.returns([nextChallenge]);
446442

@@ -541,7 +537,6 @@ describe('Unit | Domain | Use Cases | get-next-challenge', function () {
541537
.withArgs({
542538
availableChallenges: [challengeWithOtherSkill],
543539
capacity: 0,
544-
options: sinon.match.any,
545540
})
546541
.returns([challengeWithOtherSkill]);
547542

@@ -709,7 +704,6 @@ describe('Unit | Domain | Use Cases | get-next-challenge', function () {
709704
.withArgs({
710705
availableChallenges: [nextChallengeToAnswer],
711706
capacity: 0,
712-
options: sinon.match.any,
713707
})
714708
.returns([nextChallengeToAnswer]);
715709

api/tests/certification/shared/unit/domain/models/FlashAssessmentAlgorithm_test.js

-7
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ const baseFlashAssessmentAlgorithmConfig = {
1111
describe('Unit | Domain | Models | FlashAssessmentAlgorithm | FlashAssessmentAlgorithm', function () {
1212
let flashAlgorithmImplementation;
1313

14-
const baseGetNextChallengeOptions = {
15-
challengesBetweenSameCompetence: 2,
16-
minimalSuccessRate: 0,
17-
};
18-
1914
beforeEach(function () {
2015
flashAlgorithmImplementation = {
2116
getPossibleNextChallenges: sinon.stub(),
@@ -156,7 +151,6 @@ describe('Unit | Domain | Models | FlashAssessmentAlgorithm | FlashAssessmentAlg
156151
.withArgs({
157152
availableChallenges: expectedChallenges,
158153
capacity: computedCapacity,
159-
options: baseGetNextChallengeOptions,
160154
})
161155
.returns(expectedChallenges);
162156

@@ -233,7 +227,6 @@ describe('Unit | Domain | Models | FlashAssessmentAlgorithm | FlashAssessmentAlg
233227
.withArgs({
234228
availableChallenges: expectedChallenges,
235229
capacity: computedCapacity,
236-
options: baseGetNextChallengeOptions,
237230
})
238231
.returns(expectedChallenges);
239232

api/tests/unit/domain/usecases/get-next-challenge-for-campaign-assessment_test.js

-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ describe('Unit | Domain | Use Cases | get-next-challenge-for-campaign-assessment
162162
.withArgs({
163163
availableChallenges: [secondChallenge],
164164
capacity: 0,
165-
options: sinon.match.object,
166165
})
167166
.returns([secondChallenge]);
168167

@@ -273,7 +272,6 @@ describe('Unit | Domain | Use Cases | get-next-challenge-for-campaign-assessment
273272
.withArgs({
274273
challenges,
275274
capacity: 0,
276-
options: sinon.match.object,
277275
})
278276
.returns({
279277
hasAssessmentEnded: false,

0 commit comments

Comments
 (0)