Skip to content

Commit

Permalink
Fix issue with empty notification in row
Browse files Browse the repository at this point in the history
  • Loading branch information
wh0o7 committed Sep 30, 2023
1 parent d7a0429 commit f7822a7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions TeachersTimetable/Services/ParseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ public async Task ParseDay()
teacherInfo.Lessons.RemoveRange(0, count);
teacherInfo.Lessons.Reverse();

if (teacherInfo.Lessons.Count < 1)
var teacherInfoFromTimetable =
Timetable.LastOrDefault()?.TeacherInfos.FirstOrDefault(t => t.Name == teacherInfo.Name);
if (teacherInfo.Lessons.Count < 1 && teacherInfoFromTimetable is not null &&
teacherInfoFromTimetable.Lessons.Count > 0)
{
notificationUsersList.AddRange((await this._mongoService.Database.GetCollection<User>("Users")
.FindAsync(u => u.Teacher != null && u.Notifications && u.Teacher == teacherInfo.Name)).ToList());
Expand All @@ -178,8 +181,6 @@ public async Task ParseDay()
}

teacherInfo.Lessons = teacherInfo.Lessons.OrderBy(l => l.Index).ToList();
var teacherInfoFromTimetable =
Timetable.LastOrDefault()?.TeacherInfos.FirstOrDefault(t => t.Name == teacherInfo.Name);

if (teacherInfoFromTimetable is null || teacherInfoFromTimetable.Equals(teacherInfo)) continue;
teacherUpdatedList.Add(teacherInfo.Name);
Expand Down

0 comments on commit f7822a7

Please sign in to comment.