Skip to content
Snippets Groups Projects
Commit 9830b179 authored by Yorick de Vries's avatar Yorick de Vries
Browse files

Merge branch 'authorisationAnswers' into 'dev2'

Authorisation answers

See merge request !158
parents 353d101e 2bdff0ac
Branches
Tags
3 merge requests!188Dev to master,!187Dev2 to dev,!158Authorisation answers
Pipeline #365781 passed with warnings
...@@ -46,6 +46,12 @@ router.post("/", validateBody(checkboxAnswerSchema), async (req, res) => { ...@@ -46,6 +46,12 @@ router.post("/", validateBody(checkboxAnswerSchema), async (req, res) => {
.send("You are not the reviewer of this review"); .send("You are not the reviewer of this review");
return; return;
} }
if (review.submitted) {
res
.status(HttpStatusCode.FORBIDDEN)
.send("The review is already submitted");
return;
}
const questionnaire = await review.getQuestionnaire(); const questionnaire = await review.getQuestionnaire();
if (!questionnaire.containsQuestion(question)) { if (!questionnaire.containsQuestion(question)) {
res res
......
...@@ -46,6 +46,12 @@ router.post("/", validateBody(multipleChoiceAnswerSchema), async (req, res) => { ...@@ -46,6 +46,12 @@ router.post("/", validateBody(multipleChoiceAnswerSchema), async (req, res) => {
.send("You are not the reviewer of this review"); .send("You are not the reviewer of this review");
return; return;
} }
if (review.submitted) {
res
.status(HttpStatusCode.FORBIDDEN)
.send("The review is already submitted");
return;
}
const questionnaire = await review.getQuestionnaire(); const questionnaire = await review.getQuestionnaire();
if (!questionnaire.containsQuestion(question)) { if (!questionnaire.containsQuestion(question)) {
res res
......
...@@ -43,6 +43,12 @@ router.post("/", validateBody(openAnswerSchema), async (req, res) => { ...@@ -43,6 +43,12 @@ router.post("/", validateBody(openAnswerSchema), async (req, res) => {
.send("You are not the reviewer of this review"); .send("You are not the reviewer of this review");
return; return;
} }
if (review.submitted) {
res
.status(HttpStatusCode.FORBIDDEN)
.send("The review is already submitted");
return;
}
const questionnaire = await review.getQuestionnaire(); const questionnaire = await review.getQuestionnaire();
if (!questionnaire.containsQuestion(question)) { if (!questionnaire.containsQuestion(question)) {
res res
......
...@@ -43,6 +43,12 @@ router.post("/", validateBody(rangeAnswerSchema), async (req, res) => { ...@@ -43,6 +43,12 @@ router.post("/", validateBody(rangeAnswerSchema), async (req, res) => {
.send("You are not the reviewer of this review"); .send("You are not the reviewer of this review");
return; return;
} }
if (review.submitted) {
res
.status(HttpStatusCode.FORBIDDEN)
.send("The review is already submitted");
return;
}
const questionnaire = await review.getQuestionnaire(); const questionnaire = await review.getQuestionnaire();
if (!questionnaire.containsQuestion(question)) { if (!questionnaire.containsQuestion(question)) {
res res
......
...@@ -48,7 +48,7 @@ router.get("/file", validateQuery(querySchema), async (req, res) => { ...@@ -48,7 +48,7 @@ router.get("/file", validateQuery(querySchema), async (req, res) => {
// or reviwer // or reviwer
(await review.isReviewer(user)) || (await review.isReviewer(user)) ||
// or reviewed // or reviewed
(assignment.isAtOrBeforeState(AssignmentState.FEEDBACK) && (assignment.isAtState(AssignmentState.FEEDBACK) &&
(await review.isReviewed(user)) && (await review.isReviewed(user)) &&
review.submitted) review.submitted)
) { ) {
...@@ -103,6 +103,12 @@ router.post( ...@@ -103,6 +103,12 @@ router.post(
.send("You are not the reviewer of this review"); .send("You are not the reviewer of this review");
return; return;
} }
if (review.submitted) {
res
.status(HttpStatusCode.FORBIDDEN)
.send("The review is already submitted");
return;
}
const questionnaire = await review.getQuestionnaire(); const questionnaire = await review.getQuestionnaire();
if (!questionnaire.containsQuestion(question)) { if (!questionnaire.containsQuestion(question)) {
res res
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment