fix: correct show special weeks

This commit is contained in:
Polianin Nikita 2024-08-30 17:00:33 +03:00
parent 4bfd919bbc
commit 578fdff6ca

View File

@ -83,6 +83,7 @@ export class TableComponent implements OnChanges {
filteredData = filteredData.filter(x => filteredData = filteredData.filter(x =>
x.isExcludedWeeks == undefined || x.isExcludedWeeks == undefined ||
x.weeks == undefined || x.weeks == undefined ||
x.weeks.length == 0 ||
(x.isExcludedWeeks && !x.weeks.includes(this.currentWeek)) || (x.isExcludedWeeks && !x.weeks.includes(this.currentWeek)) ||
(!x.isExcludedWeeks && x.weeks.includes(this.currentWeek)) (!x.isExcludedWeeks && x.weeks.includes(this.currentWeek))
); );
@ -99,12 +100,12 @@ export class TableComponent implements OnChanges {
convertedData.data[dayOfWeek.toString()] = Object.values(groupedData).map(item => { convertedData.data[dayOfWeek.toString()] = Object.values(groupedData).map(item => {
item.group = item.groups.join(', '); item.group = item.groups.join(', ');
if (this.isDisciplineWithWeeks && item.weeks && item.isExcludedWeeks !== undefined) { if (this.isDisciplineWithWeeks && item.weeks !== undefined && item.weeks.length > 0 && item.isExcludedWeeks !== undefined) {
if (this.backupDisciplines[item.disciplineId]) { if (this.backupDisciplines[item.disciplineId])
item.discipline = this.backupDisciplines[item.disciplineId]; item.discipline = this.backupDisciplines[item.disciplineId];
} else { else
this.backupDisciplines[item.disciplineId] = item.discipline; this.backupDisciplines[item.disciplineId] = item.discipline;
}
item.discipline = `${item.isExcludedWeeks ? 'кр.' : 'н.'} ${item.weeks.join(', ')} ${item.discipline}`; item.discipline = `${item.isExcludedWeeks ? 'кр.' : 'н.'} ${item.weeks.join(', ')} ${item.discipline}`;
} else if (this.backupDisciplines[item.disciplineId]) } else if (this.backupDisciplines[item.disciplineId])
item.discipline = this.backupDisciplines[item.disciplineId]; item.discipline = this.backupDisciplines[item.disciplineId];