feat: split group by graduate

This commit is contained in:
2024-08-31 02:18:55 +03:00
parent 5ee350b66c
commit 42d831892a
3 changed files with 82 additions and 8 deletions

View File

@ -30,7 +30,9 @@ export class GroupComponent implements IScheduleTab {
protected faculties: FacultyResponse[] | null = null;
protected courseNumbers: number[] | null = null;
private groups: GroupResponse[] | null = null;
protected filteredGroups: GroupResponse[] | null = [];
protected filteredGroupsBehaviour: GroupResponse[] | null = null;
protected filteredGroupsMagistracy: GroupResponse[] | null = null;
protected filteredGroupsSpecialist: GroupResponse[] | null = null;
protected facultyId: number | null = null;
protected courseNumber: number | null = null;
@ -132,8 +134,17 @@ export class GroupComponent implements IScheduleTab {
return;
}
if (this.courseNumber !== null)
this.filteredGroups = this.groups!.filter(x => x.courseNumber === this.courseNumber);
if (this.courseNumber !== null) {
const groupByCourse = this.groups!.filter(x => x.courseNumber === this.courseNumber);
groupByCourse.forEach(x => {
if (x.name[2].toUpperCase() === 'Б')
this.filteredGroupsBehaviour?.push(x);
else if (x.name[2].toUpperCase() === 'С')
this.filteredGroupsSpecialist?.push(x);
else
this.filteredGroupsMagistracy?.push(x);
});
}
}
protected onFacultySelected(index: number) {
@ -156,7 +167,9 @@ export class GroupComponent implements IScheduleTab {
}
protected onCourseSelected(course: number) {
this.filteredGroups = [];
this.filteredGroupsBehaviour = [];
this.filteredGroupsMagistracy = [];
this.filteredGroupsSpecialist = [];
this.formChipGroup.reset();
if (course === undefined) {