Skip to content

Commit 0295d74

Browse files
authored
feat(api): remove global feedback in qcu for answer verification
1 parent 7171c9d commit 0295d74

File tree

4 files changed

+97
-298
lines changed

4 files changed

+97
-298
lines changed

api/src/devcomp/domain/models/element/QCU-for-answer-verification.js

+4-14
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,20 @@ import Joi from 'joi';
33
import { EntityValidationError } from '../../../../shared/domain/errors.js';
44
import { assertNotNullOrUndefined } from '../../../../shared/domain/models/asserts.js';
55
import { ModuleInstantiationError } from '../../errors.js';
6-
import { Feedbacks } from '../Feedbacks.js';
76
import { QcuCorrectionResponse } from '../QcuCorrectionResponse.js';
87
import { ValidatorQCU } from '../validator/ValidatorQCU.js';
98
import { QCU } from './QCU.js';
109

1110
class QCUForAnswerVerification extends QCU {
1211
userResponse;
13-
constructor({ id, instruction, locales, proposals, solution, feedbacks, validator }) {
12+
constructor({ id, instruction, locales, proposals, solution, validator }) {
1413
super({ id, instruction, locales, proposals });
1514

1615
assertNotNullOrUndefined(solution, 'The solution is required for a verification QCU');
1716
this.#assertSolutionIsAnExistingProposal(solution, proposals);
1817

1918
this.solution = { value: solution };
2019

21-
if (feedbacks) {
22-
this.feedbacks = new Feedbacks(feedbacks);
23-
}
24-
2520
if (validator) {
2621
this.validator = validator;
2722
} else {
@@ -46,7 +41,7 @@ class QCUForAnswerVerification extends QCU {
4641

4742
return new QcuCorrectionResponse({
4843
status: validation.result,
49-
feedback: this.#getFeedback(validation),
44+
feedback: this.#getFeedback(),
5045
solution: this.solution.value,
5146
});
5247
}
@@ -71,13 +66,8 @@ class QCUForAnswerVerification extends QCU {
7166
}
7267
}
7368

74-
#getFeedback(validation) {
75-
const specificFeedback = this.#getSpecificFeedbackByProposalId(this.userResponse);
76-
if (specificFeedback) {
77-
return specificFeedback;
78-
}
79-
80-
return validation.result.isOK() ? this.feedbacks.valid : this.feedbacks.invalid;
69+
#getFeedback() {
70+
return this.#getSpecificFeedbackByProposalId(this.userResponse);
8171
}
8272
}
8373

api/src/devcomp/infrastructure/factories/element-for-verification-factory.js

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export class ElementForVerificationFactory {
5050
feedback: proposal.feedback,
5151
});
5252
}),
53-
feedbacks: element.feedbacks,
5453
solution: element.solution,
5554
});
5655
}

0 commit comments

Comments
 (0)