Skip to content

Commit

Permalink
Fix history button inconsistensy and translation
Browse files Browse the repository at this point in the history
  • Loading branch information
VirmasaloA authored and lupari committed Sep 23, 2024
1 parent 724044d commit fe37d04
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 20 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);
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
6 changes: 2 additions & 4 deletions ui/src/app/exam/editor/exam-tabs.component.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<xm-page-header [text]="examInfo.title || 'loading'" [prependTemplate]="linkBack" [appendTemplate]="status" />
<xm-page-content [content]="content" />
<ng-template #linkBack>
<a [routerLink]="[user.isAdmin ? '/staff/admin' : '/staff/teacher']">
<img class="pointer arrow_icon pe-4" src="/assets/images/icon_history.png" alt="go back" />
</a>
<xm-history-back></xm-history-back>
</ng-template>
<ng-template #status>
@if (exam?.state) {
<span class="exam-status float-end me-3">{{ 'i18n_' + exam.state | lowercase | translate }} </span>
<span class="exam-status float-end pe-3">{{ 'i18n_' + exam.state | lowercase | translate }} </span>
}
</ng-template>
<ng-template #content>
Expand Down
2 changes: 2 additions & 0 deletions ui/src/app/exam/editor/exam-tabs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import type { User } from 'src/app/session/session.service';
import { SessionService } from 'src/app/session/session.service';
import { PageContentComponent } from 'src/app/shared/components/page-content.component';
import { PageHeaderComponent } from 'src/app/shared/components/page-header.component';
import { HistoryBackComponent } from 'src/app/shared/history/history-back.component';
import { CourseCodeService } from 'src/app/shared/miscellaneous/course-code.service';
import type { UpdateProps } from './exam-tabs.service';
import { ExamTabService } from './exam-tabs.service';
Expand All @@ -44,6 +45,7 @@ import { ExamTabService } from './exam-tabs.service';
TranslateModule,
PageHeaderComponent,
PageContentComponent,
HistoryBackComponent,
],
styleUrl: './exam-tabs.component.scss',
})
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/question/basequestion/question.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}
<xm-page-content [content]="content" />
<ng-template #linkBack>
<img (click)="cancel()" class="pointer arrow_icon pe-3" src="/assets/images/icon_history.png" alt="go back" />
<xm-history-back></xm-history-back>
</ng-template>
<ng-template #content>
<div class="row">
Expand Down
10 changes: 9 additions & 1 deletion ui/src/app/question/basequestion/question.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@ import { QuestionService } from 'src/app/question/question.service';
import type { User } from 'src/app/session/session.service';
import { PageContentComponent } from 'src/app/shared/components/page-content.component';
import { PageHeaderComponent } from 'src/app/shared/components/page-header.component';
import { HistoryBackComponent } from 'src/app/shared/history/history-back.component';
import { QuestionBodyComponent } from './question-body.component';

@Component({
selector: 'xm-question',
templateUrl: './question.component.html',
styleUrls: ['../question.shared.scss'],
standalone: true,
imports: [FormsModule, QuestionBodyComponent, TranslateModule, PageHeaderComponent, PageContentComponent],
imports: [
FormsModule,
QuestionBodyComponent,
TranslateModule,
PageHeaderComponent,
PageContentComponent,
HistoryBackComponent,
],
})
export class QuestionComponent implements OnInit, OnDestroy, CanComponentDeactivate {
@Input() newQuestion = false;
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
11 changes: 9 additions & 2 deletions ui/src/app/shared/history/history-back.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@
*
*/
import { Component } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';

@Component({
selector: 'xm-history-back',
template: `
<button class="btn btn-link" (click)="goBack($event)" (keydown)="onKeyDown($event)">
<img class="pointer arrow_icon" src="/assets/images/icon_history.png" alt="go back" />
<button
class="btn btn-link"
(click)="goBack($event)"
(keydown)="onKeyDown($event)"
[attr.aria-label]="'i18n_go_back' | translate"
>
<img class="pointer arrow_icon h-80 align-self-center" src="/assets/images/icon_history.png" alt="" />
</button>
`,
standalone: true,
imports: [TranslateModule],
})
export class HistoryBackComponent {
goBack = (event: Event) => {
Expand Down

0 comments on commit fe37d04

Please sign in to comment.