Skip to content

Commit

Permalink
Fix issue with empty notification in row #2
Browse files Browse the repository at this point in the history
  • Loading branch information
wh0o7 committed Sep 30, 2023
1 parent 488cba8 commit fc9b395
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions StudentsTimetable/Services/ParseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,18 @@ public async Task ParseDay()

var groupInfoFromTimetable =
Timetable.LastOrDefault()?.GroupInfos.FirstOrDefault(g => g.Number == groupInfo.Number);
if (groupInfo.Lessons.Count < 1 && groupInfoFromTimetable?.Lessons is not null &&
groupInfoFromTimetable.Lessons.Count > 0)
if (groupInfo.Lessons.Count < 1)
{
notificationUserList.AddRange(
(await this._mongoService.Database.GetCollection<User>("Users")
.FindAsync(u => u.Group != null && u.Notifications)).ToList().Where(u =>
{
if (u?.Group != null &&
int.TryParse(Regex.Replace(u.Group, "[^0-9]", ""), out int userGroupNumber))
return userGroupNumber == groupInfo.Number;
return false;
}).ToList());
if (groupInfoFromTimetable?.Lessons is not null && groupInfoFromTimetable.Lessons.Count > 0)
notificationUserList.AddRange(
(await this._mongoService.Database.GetCollection<User>("Users")
.FindAsync(u => u.Group != null && u.Notifications)).ToList().Where(u =>
{
if (u?.Group != null &&
int.TryParse(Regex.Replace(u.Group, "[^0-9]", ""), out int userGroupNumber))
return userGroupNumber == groupInfo.Number;
return false;
}).ToList());
continue;
}

Expand Down

0 comments on commit fc9b395

Please sign in to comment.