Skip to content

Commit

Permalink
Fix issue with daily mailing
Browse files Browse the repository at this point in the history
  • Loading branch information
wh0o7 committed Sep 27, 2023
1 parent 2df693a commit b50ed22
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions TeachersTimetable/Services/ParseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ public async Task ParseDay()
}
catch (Exception e)
{
this._botService.SendAdminMessage(new SendMessageArgs(0, e.Message));
this._botService.SendAdminMessage(new SendMessageArgs(0,
"Ошибка дневного расписания в учителе: " + teacher));
_ = this._botService.SendAdminMessageAsync(new SendMessageArgs(0, e.Message));
_ = this._botService.SendAdminMessageAsync(new SendMessageArgs(0,
"Ошибка дневного расписания у преподавателя: " + teacher));
}
}

Expand All @@ -159,7 +159,12 @@ public async Task ParseDay()
teacherInfo.Lessons.RemoveRange(0, count);
teacherInfo.Lessons.Reverse();

if (teacherInfo.Lessons.Count < 1) continue;
if (teacherInfo.Lessons.Count < 1)
{
notificationUsersList.AddRange((await this._mongoService.Database.GetCollection<User>("Users")
.FindAsync(u => u.Teacher != null && u.Notifications && u.Teacher == teacherInfo.Name)).ToList());
continue;
}

for (var i = 0; i < teacherInfo.Lessons.First().Index - 1; i++)
{
Expand All @@ -179,9 +184,8 @@ public async Task ParseDay()
teacherUpdatedList.Add(teacherInfo.Name);
try
{
var userList = (await this._mongoService.Database.GetCollection<User>("Users")
.FindAsync(u => u.Teacher != null && u.Notifications && u.Teacher == teacherInfo.Name)).ToList();
notificationUsersList.AddRange(userList);
notificationUsersList.AddRange((await this._mongoService.Database.GetCollection<User>("Users")
.FindAsync(u => u.Teacher != null && u.Notifications && u.Teacher == teacherInfo.Name)).ToList());
}
catch (Exception e)
{
Expand Down

0 comments on commit b50ed22

Please sign in to comment.