Skip to content

Commit

Permalink
CSCEXAM-1300 Fix resolution between collab exams and none one
Browse files Browse the repository at this point in the history
  • Loading branch information
VirmasaloA authored and lupari committed Sep 26, 2024
1 parent f72b85e commit 76ff4bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
17 changes: 7 additions & 10 deletions app/controllers/ReviewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ public Result sendInspectionMessage(Long eid, Http.Request request) {
@Authenticated
@Restrict({ @Group("TEACHER"), @Group("ADMIN") })
@Anonymous(filteredProperties = { "user" })
public Result listNoShows(Long eid, Http.Request request) {
List<ExamEnrolment> enrolments = DB
public Result listNoShows(Long eid, Optional<Boolean> collaborative, Http.Request request) {
ExpressionList<ExamEnrolment> el = DB
.find(ExamEnrolment.class)
.fetch("exam", "id, name, state, gradedTime, customCredit, trialCount, anonymous")
.fetch("collaborativeExam")
Expand All @@ -449,14 +449,11 @@ public Result listNoShows(Long eid, Http.Request request) {
.fetch("exam.course", "code, credits")
.fetch("exam.grade", "id, name")
.where()
.or()
.eq("exam.id", eid)
.eq("exam.parent.id", eid)
.eq("collaborativeExam.id", eid)
.endOr()
.eq("noShow", true)
.orderBy("reservation.endAt")
.findList();
.eq("noShow", true);
var query = collaborative.orElse(false)
? el.eq("collaborativeExam.id", eid)
: el.or().eq("exam.id", eid).eq("exam.parent.id", eid).endOr();
var enrolments = query.findList();
final Result result = ok(enrolments);
Set<Long> anonIds = enrolments
.stream()
Expand Down
2 changes: 1 addition & 1 deletion conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ PUT /app/review/examquestion/:id/score controlle
PUT /app/review/examquestion/:id/score/force controllers.ReviewController.forceScoreExamQuestion(id: Long, request: Request)
PUT /app/review/:eid/comment controllers.ReviewController.updateComment(eid: Long, request: Request)
PUT /app/review/:eid/comment/:cid/feedbackstatus controllers.ReviewController.setCommentStatusRead(eid: Long, cid: Long, request: Request)
GET /app/noshows/:eid controllers.ReviewController.listNoShows(eid: Long, request: Request)
GET /app/noshows/:eid controllers.ReviewController.listNoShows(eid: Long, collaborative: java.util.Optional[java.lang.Boolean], request: Request)
PUT /app/reviews/archive controllers.ReviewController.archiveExams(request: Request)
GET /app/review/:eid controllers.ReviewController.getExamReview(eid: Long, request: Request)
GET /app/review/:id/locked controllers.ReviewController.hasLockedAssessments(id: Long)
Expand Down
4 changes: 3 additions & 1 deletion ui/src/app/review/listing/review-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export class ReviewListComponent implements OnInit, OnChanges {
this.exam = this.Tabs.getExam();
this.collaborative = this.Tabs.isCollaborative();
this.refreshLists();
this.http.get<ExamEnrolment[]>(`/app/noshows/${this.exam.id}`).subscribe((resp) => (this.noShows = resp));
this.http
.get<ExamEnrolment[]>(`/app/noshows/${this.exam.id}`, { params: { collaborative: this.collaborative } })
.subscribe((resp) => (this.noShows = resp));
this.Tabs.notifyTabChange(5);
});
}
Expand Down

0 comments on commit 76ff4bb

Please sign in to comment.