You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/store/index.ts
+16-10Lines changed: 16 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -41,16 +41,22 @@ export default createStore({
41
41
(Number(newDate(task.dueDate+" 23:59:59.999"))-
42
42
Number(newDate().setHours(23,59,59,999)))/
43
43
(1000*60*60*24);//calculate the number of days until the task is due
44
-
constdateMultiplier: number=
45
-
daysToDue<0
46
-
? -2/(daysToDue-1)
47
-
: daysToDue===0
48
-
? 4/
49
-
(1+
50
-
(Number(newDate().setHours(23,59,59,999))-
51
-
Number(newDate()))/
52
-
(1000*24*60*60))
53
-
: 1+1/(daysToDue+1);//if the task is overdue, XP and score multiplier is less than 1 that decreases over time when the task is overdue, else XP multiplier bonus increases (more than 1) when the task gets closer to due date
44
+
letdateMultiplier: number;
45
+
if(daysToDue<0){
46
+
//if the task is overdue, XP and score multiplier is less than 1 that decreases over time when the task is overdue
47
+
dateMultiplier=-2/(daysToDue-1);
48
+
}elseif(daysToDue===0){
49
+
//if the task is due today, XP and score multiplier bonus increases more than 2 based on the time the task is completed
50
+
dateMultiplier=
51
+
4/
52
+
(1+
53
+
(Number(newDate().setHours(23,59,59,999))-
54
+
Number(newDate()))/
55
+
(1000*24*60*60));
56
+
}else{
57
+
//else XP and score multiplier bonus increases (more than 1) when the task gets closer to due date
58
+
dateMultiplier=1+1/(daysToDue+1);
59
+
}
54
60
letstreakMultiplier: number;//calculate task streak XP and score multiplier based on task streak, if the task is completed before the due date, then the streak increases else if the task is completed overdue (after the due date) reset task streak to 0
55
61
letrepeatMultiplier: number;//calculate task repetition XP and score multiplier based on task repetition occurrence and task repetition interval
56
62
letdailyStreakMultiplier: number;//calculate daily streak XP and score multiplier based on daily streak
0 commit comments