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
+13-4Lines changed: 13 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ export default createStore({
4
4
state: {
5
5
todos: []asany[],
6
6
user: {
7
-
level: 0,
8
-
xp: 0,
9
-
progress: 0,
7
+
level: 0asnumber,
8
+
xp: 0asnumber,
9
+
progress: 0asnumber,
10
10
},
11
11
},
12
12
getters: {
@@ -20,7 +20,16 @@ export default createStore({
20
20
consttask=state.todos.find(
21
21
(todo: {newId: number})=>todo.newId===payload
22
22
);
23
-
constxp=Math.max(task.difficulty*task.priority,1);//get at least 1 xp when the task is completed
23
+
constdaysToDue: number=
24
+
(Number(newDate(task.dueDate+" 23:59:59.999"))-
25
+
Number(newDate().setHours(23,59,59,999)))/
26
+
(1000*24*60*60);//calculate number of days until the task is due
27
+
constdateMultiplier: number=
28
+
daysToDue<0 ? 0.5 : 1+1/(daysToDue+1);//if task is overdue, xp multiplier is half the amount, else xp multiplier bonus increases when task gets closer to due date
0 commit comments