@universis/evaluations 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/models/ClassInstructorEvaluationEvent.json +12 -3
- package/dist/config/models/CourseClassEvaluationEvent.json +9 -2
- package/dist/evaluationRouter.js +14 -0
- package/dist/evaluationRouter.js.map +1 -1
- package/dist/handlers/evaluation-key-handler.js +1 -1
- package/dist/handlers/evaluation-key-handler.js.map +1 -1
- package/dist/listeners/class-instructor-event-listener.js +38 -1
- package/dist/listeners/class-instructor-event-listener.js.map +1 -1
- package/dist/locales/el.json +19 -0
- package/dist/models/class-instructor-evaluation-event-model.js +197 -172
- package/dist/models/class-instructor-evaluation-event-model.js.map +1 -1
- package/dist/models/evaluation-event-model.js +12 -3
- package/dist/models/evaluation-event-model.js.map +1 -1
- package/package.json +1 -1
- package/src/config/models/ClassInstructorEvaluationEvent.json +12 -3
- package/src/config/models/CourseClassEvaluationEvent.json +9 -2
- package/src/evaluationRouter.js +14 -0
- package/src/handlers/evaluation-key-handler.js +1 -1
- package/src/listeners/class-instructor-event-listener.js +38 -0
- package/src/locales/el.json +19 -0
- package/src/models/class-instructor-evaluation-event-model.js +60 -35
- package/src/models/evaluation-event-model.js +13 -4
|
@@ -46,23 +46,32 @@ class EvaluationEvent extends DataObject {
|
|
|
46
46
|
// get evaluation key
|
|
47
47
|
const token = await EvaluationAccessToken.inspect(context, context.user && context.user.authenticationToken);
|
|
48
48
|
if (token.active === false) {
|
|
49
|
-
throw new HttpTokenExpiredError('Evaluation access token has been expired or is invalid.');
|
|
49
|
+
throw new HttpTokenExpiredError(context.__('Evaluation access token has been expired or is invalid.'));
|
|
50
50
|
}
|
|
51
51
|
// get evaluation event
|
|
52
52
|
// get current date
|
|
53
53
|
let evaluationEvent = await context.model('EvaluationEvent')
|
|
54
54
|
.where('id').equal(token.sub)
|
|
55
|
-
.
|
|
55
|
+
.expand('eventStatus')
|
|
56
56
|
.silent().getTypedItem();
|
|
57
57
|
if (evaluationEvent == null) {
|
|
58
58
|
throw new HttpNotFoundError('The specified evaluation cannot be found');
|
|
59
59
|
}
|
|
60
|
+
if (evaluationEvent.eventStatus )
|
|
61
|
+
{
|
|
62
|
+
if (evaluationEvent.eventStatus.alternateName!=='EventOpened') {
|
|
63
|
+
throw new DataError('E_CLOSED_EVENT',context.__('The course evaluation has been closed and is no longer available') );
|
|
64
|
+
}
|
|
65
|
+
}
|
|
60
66
|
// check dates
|
|
61
67
|
const currentDate = new Date().setHours(0,0,0,0);
|
|
62
68
|
const startDate = evaluationEvent.startDate.setHours(0,0,0,0);
|
|
63
69
|
const endDate = evaluationEvent.endDate.setHours(0,0,0,0);
|
|
64
|
-
if (
|
|
65
|
-
throw new
|
|
70
|
+
if (currentDate < startDate) {
|
|
71
|
+
throw new DataError('E_NOT_STARTED',context.__('Evaluation period for this course has not been started yet'));
|
|
72
|
+
}
|
|
73
|
+
if (currentDate > endDate) {
|
|
74
|
+
throw new DataError('E_EXPIRED',context.__('Evaluation period for this course has been expired'));
|
|
66
75
|
}
|
|
67
76
|
if (evaluationEvent.additionalType !== 'EvaluationEvent') {
|
|
68
77
|
if (evaluationEvent.additionalType === 'ClassInstructorEvaluationEvent') {
|