[O] Cache unread assignments
This commit is contained in:
@@ -53,7 +53,7 @@
|
|||||||
import OverallLine from '@/pages/overall/overall-line/overall-line';
|
import OverallLine from '@/pages/overall/overall-line/overall-line';
|
||||||
import OverallBar from '@/pages/overall/overall-bar/overall-bar';
|
import OverallBar from '@/pages/overall/overall-bar/overall-bar';
|
||||||
import OverallCourse from '@/pages/overall/overall-course/overall-course';
|
import OverallCourse from '@/pages/overall/overall-course/overall-course';
|
||||||
import Course from '@/logic/course';
|
import Course, {Assignment} from '@/logic/course';
|
||||||
import {GPAUtils} from '@/logic/utils/gpa-utils';
|
import {GPAUtils} from '@/logic/utils/gpa-utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -74,6 +74,8 @@
|
|||||||
return GPAUtils.getGPA(this.courses);
|
return GPAUtils.getGPA(this.courses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For clear unread prompt
|
||||||
|
unread: Assignment[];
|
||||||
/**
|
/**
|
||||||
* On page load - check if the user has too many notifications
|
* On page load - check if the user has too many notifications
|
||||||
*/
|
*/
|
||||||
@@ -83,11 +85,10 @@
|
|||||||
if (!this.$cookies.isKey('IgnoreUnread'))
|
if (!this.$cookies.isKey('IgnoreUnread'))
|
||||||
{
|
{
|
||||||
// Count unread
|
// Count unread
|
||||||
let unread = this.courses.reduce((p, c) => p +
|
this.unread = this.courses.flatMap(c => c.assignments.filter(a => a.unread));
|
||||||
c.assignments.reduce((p, a) => p + (a.unread ? 1 : 0), 0), 0);
|
|
||||||
|
|
||||||
// Prompt clear
|
// Prompt clear
|
||||||
if (unread > 15)
|
if (this.unread.length > 15)
|
||||||
{
|
{
|
||||||
this.promptClearNotification = true;
|
this.promptClearNotification = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user