From 1a6100fdcbfafba381892d4e03caaca428e8acff Mon Sep 17 00:00:00 2001 From: Andruxxa7 Date: Sun, 1 Oct 2023 01:51:20 +0300 Subject: [PATCH] Fix issue with empty notification in row #2 --- TeachersTimetable/Services/ParseService.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/TeachersTimetable/Services/ParseService.cs b/TeachersTimetable/Services/ParseService.cs index fc55fa9..5498984 100644 --- a/TeachersTimetable/Services/ParseService.cs +++ b/TeachersTimetable/Services/ParseService.cs @@ -1,5 +1,4 @@ -using System.Text.RegularExpressions; -using MongoDB.Driver; +using MongoDB.Driver; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Interactions; @@ -162,11 +161,12 @@ public async Task ParseDay() var teacherInfoFromTimetable = Timetable.LastOrDefault()?.TeacherInfos.FirstOrDefault(t => t.Name == teacherInfo.Name); - if (teacherInfo.Lessons.Count < 1 && teacherInfoFromTimetable?.Lessons is not null && - teacherInfoFromTimetable.Lessons.Count > 0) + if (teacherInfo.Lessons.Count < 1) { - notificationUsersList.AddRange((await this._mongoService.Database.GetCollection("Users") - .FindAsync(u => u.Teacher != null && u.Notifications && u.Teacher == teacherInfo.Name)).ToList()); + if (teacherInfoFromTimetable?.Lessons is not null && teacherInfoFromTimetable.Lessons.Count > 0) + notificationUsersList.AddRange((await this._mongoService.Database.GetCollection("Users") + .FindAsync(u => u.Teacher != null && u.Notifications && u.Teacher == teacherInfo.Name)) + .ToList()); continue; }