[+] Detect notification count

This commit is contained in:
Hykilpikonna
2019-12-21 18:25:43 -05:00
parent d4d8312016
commit 4047a3e8f6
+23 -1
View File
@@ -65,14 +65,36 @@
{
@Prop({required: true}) courses: Course[];
promptClearNotification = false;
/**
* This function is called to get gpa since I can't import another
* class in the Vue file.
*/
public getGPA()
getGPA()
{
return GPAUtils.getGPA(this.courses);
}
/**
* On page load - check if the user has too many notifications
*/
mounted()
{
// Check unread
if (!this.$cookies.isKey('IgnoreUnread'))
{
// Count unread
let unread = this.courses.reduce((p, c) => p +
c.assignments.reduce((p, a) => p + (a.unread ? 1 : 0), 0), 0);
// Prompt clear
if (unread > 15)
{
this.promptClearNotification = true;
}
}
}
}
</script>