Skip to content

Commit

Permalink
Merge branch 'dev' into CSCEXAM-1325
Browse files Browse the repository at this point in the history
  • Loading branch information
lupari authored Aug 12, 2024
2 parents 6a79e2f + f8045e9 commit 91e82bc
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
33 changes: 18 additions & 15 deletions app/util/datetime/DateTimeHandlerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.joda.time.DateTimeZone;
import org.joda.time.Interval;
import org.joda.time.LocalDate;
import org.joda.time.LocalTime;
import util.config.ConfigReader;

public class DateTimeHandlerImpl implements DateTimeHandler {
Expand Down Expand Up @@ -115,13 +114,25 @@ public List<Interval> getExceptionEvents(
DateTime end = new DateTime(ewh.getEndDate()).plusMillis(ewh.getEndDateTimezoneOffset());
Interval exception = new Interval(start, end);
Interval wholeDay = date.toInterval();
// exception covers this day fully
if (exception.contains(wholeDay) || exception.equals(wholeDay)) {
exceptions.clear();
exceptions.add(wholeDay);
break;
}
if (exception.overlaps(wholeDay)) {
exceptions.add(new Interval(exception.getStart(), exception.getEnd()));
} else if (exception.overlaps(wholeDay)) {
// exception starts this day but ends on a later day
if (start.toLocalDate().equals(date) && end.toLocalDate().isAfter(date)) {
exceptions.add(new Interval(exception.getStart(), wholeDay.getEnd()));
}
// exception ends this day but starts on an earlier day
else if (start.toLocalDate().isBefore(date) && end.toLocalDate().equals(date)) {
exceptions.add(new Interval(wholeDay.getStart(), exception.getEnd()));
}
// exception starts and ends this day
else {
exceptions.add(
new Interval(exception.getStart().withDate(date), exception.getEnd().withDate(date))
);
}
}
}
}
Expand Down Expand Up @@ -275,17 +286,9 @@ public List<OpeningHours> getWorkingHoursForDate(LocalDate date, ExamRoom room)
List<Interval> unifiedIntervals = mergeSlots(
Stream.concat(workingHours.stream().map(OpeningHours::getHours), extensionEvents.stream()).toList()
);
int tzOffset;
if (workingHours.isEmpty()) {
LocalTime lt = LocalTime.now().withHourOfDay(java.time.LocalTime.NOON.getHour());
tzOffset = DateTimeZone.forID(room.getLocalTimezone()).getOffset(date.toDateTime(lt));
} else {
tzOffset = workingHours.getFirst().getTimezoneOffset();
}
int offset = DateTimeZone.forID(room.getLocalTimezone()).getOffset(DateTime.now().withDayOfYear(1));
workingHours.clear();
workingHours.addAll(
unifiedIntervals.stream().map(interval -> new OpeningHours(interval, tzOffset)).toList()
);
workingHours.addAll(unifiedIntervals.stream().map(interval -> new OpeningHours(interval, offset)).toList());
}
if (!restrictionEvents.isEmpty()) {
for (OpeningHours hours : workingHours) {
Expand Down
5 changes: 3 additions & 2 deletions ui/src/app/navigation/navigation.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
class="mobile-menu"
(click)="openMenu()"
[hidden]="!user"
[attr.aria-open]="mobileMenuOpen"
[attr.aria-expanded]="mobileMenuOpen"
[attr.aria-label]="'i18n_open_main_menu' | translate"
>
<img src="/assets/images/icon_menu_mobile.svg" alt="{{ 'i18n_mobile_menu' | translate }}" />
<img src="/assets/images/icon_menu_mobile.svg" alt="" />
</button>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion ui/src/app/review/assessment/sections/section.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ export class ExamSectionComponent implements OnInit, AfterViewInit {
this.essayQuestionAmounts = this.Question.getEssayQuestionAmountsBySection(this.section);
};

// getReviewProgress gathers the questions that have been reviewed by calculating essay answers that have been evaluated plus the rest of the questions.
// Since the essay questions are the only ones that need to be evaluated and the rest of the questions are evaluated automatically.
getReviewProgress = () => {
return this.section.sectionQuestions.filter((q: ExamSectionQuestion) => {
return q.forcedScore || q.essayAnswer?.evaluatedScore;
return q.question.type !== 'EssayQuestion' || q.essayAnswer?.evaluatedScore;
}).length;
};

Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@
"i18n_date_too_far_in_future": "Selected date is later than latest date allowed:",
"i18n_enrolment_assessment_not_received": "Re-enrolment is not possible because your previous examination has not returned from exam visit university",
"i18n_not_allowed_to_modify_reservation": "Your current reservation is active so you can't edit it",
"i18n_mobile_menu": "Mobile menu",
"i18n_open_main_menu": "Open main menu",
"i18n_exam_logo": "Exam logo",
"i18n_show_hide_clock": "Show/hide time",
"i18n_select_time_in_future": "Time must be in future",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@
"i18n_date_too_far_in_future": "Valittu ajankohta on myöhemmin kuin kaukaisin tällä hetkellä sallittu:",
"i18n_enrolment_assessment_not_received": "Uudelleen ilmoittautuminen ei sallittu, edellinen tenttivierailusuoritus ei ole vielä saapunut",
"i18n_not_allowed_to_modify_reservation": "Varaus on käynnissä ja sitä ei voi muuttaa",
"i18n_mobile_menu": "Mobiili-menu",
"i18n_open_main_menu": "Avaa päävalikko",
"i18n_exam_logo": "Exam-logo",
"i18n_show_hide_clock": "Näytä/piilota aika",
"i18n_select_time_in_future": "Valitse aika tulevaisuudesta",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/i18n/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@
"i18n_date_too_far_in_future": "Det valda datumet är senare än sista möjliga tidpunkt:",
"i18n_enrolment_assessment_not_received": "Det är inte tillåtet att anmäla sig på nytt, eftersom den föregående tentamensprestationen inte ännu har kommit från den högskola där du skrev tentamen. ",
"i18n_not_allowed_to_modify_reservation": "Din bokning pågår och kan därför inte ändras",
"i18n_mobile_menu": "Mobilmeny",
"i18n_open_main_menu": "Öppna huvudmenyn",
"i18n_exam_logo": "Examlogo",
"i18n_show_hide_clock": "Visa/dölj tiden",
"i18n_select_time_in_future": "Välj tidpunkt i framtiden",
Expand Down

0 comments on commit 91e82bc

Please sign in to comment.