only show normal grade notifications

This commit is contained in:
Kima 2023-08-26 20:19:05 +02:00
parent ee2a42bbe2
commit 8ff4f0b88f
2 changed files with 37 additions and 25 deletions

View File

@ -42,6 +42,8 @@ class NotificationsHelper {
// loop through grades and see which hasn't been seen yet
for (Grade grade in grades) {
// if grade is not a normal grade (1-5), don't show it
if ([1, 2, 3, 4, 5].contains(grade.value.value)) {
// if the grade was added over a week ago, don't show it to avoid notification spam
if (grade.seenDate.isAfter(lastSeenGrade) &&
grade.date.difference(DateTime.now()).inDays * -1 < 7) {
@ -69,6 +71,7 @@ class NotificationsHelper {
notificationDetails);
}
}
}
// set grade seen status
gradeProvider.seenAll();
}

View File

@ -101,7 +101,16 @@ class GradeValue {
case "rossz":
return 2;
case "hanyag":
return 1;
// other
case "jeles":
return 5;
case "kozepes":
return 3;
case "elegseges":
return 2;
case "elegtelen":
return 1;
}
}
return _value;