fix: catalog module semester selection

This commit is contained in:
Rainer Killinger
2023-04-20 11:24:23 +02:00
parent 9e160e8d1e
commit afbd1fc048
2 changed files with 5 additions and 4 deletions

View File

@@ -117,8 +117,9 @@ export class CatalogComponent implements OnInit, OnDestroy {
semester => semester.startDate <= today && semester.endDate > today, semester => semester.startDate <= today && semester.endDate > today,
); );
const currentSemesterIndex = semesters.findIndex(semester => semester.uid === currentSemester?.uid); const currentSemesterIndex = semesters.findIndex(semester => semester.uid === currentSemester?.uid);
this.availableSemesters = semesters.slice(currentSemesterIndex - 1, currentSemesterIndex + 2).reverse(); this.availableSemesters = semesters
.slice(Math.max(0, currentSemesterIndex - 1), Math.min(currentSemesterIndex + 2, semesters.length))
.reverse();
if (typeof this.activeSemester !== 'undefined') { if (typeof this.activeSemester !== 'undefined') {
return; return;
} }

View File

@@ -121,11 +121,11 @@ export class CatalogProvider {
arguments: { arguments: {
bounds: { bounds: {
lowerBound: { lowerBound: {
limit: `${new Date().setFullYear(new Date().getFullYear() - 1)}`, limit: `${new Date(new Date().setFullYear(new Date().getFullYear() - 1)).toISOString}`,
mode: 'inclusive', mode: 'inclusive',
}, },
upperBound: { upperBound: {
limit: `${new Date().setFullYear(new Date().getFullYear() + 1)}`, limit: `${new Date(new Date().setFullYear(new Date().getFullYear() + 1)).toISOString}`,
mode: 'inclusive', mode: 'inclusive',
}, },
}, },