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
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,15 @@ export default createStore({
10
10
xp: 0asnumber,
11
11
progress: 0asnumber,
12
12
score: 0asnumber,//set score to 0 when state is created
13
-
bestScoreEarned: 0asnumber,//the highest number of points earned achieved when a task is completed
13
+
bestScoreEarned: 0asnumber,//the highest number of points earned achieved when the task is completed
14
14
dailyStreak: 0asnumber,//set daily streak to 0 and last completion date to undefined when state is created
15
15
tasksCompletedToday: 0asnumber,//set the number of tasks completed in a day (today) to 0
16
16
totalTasksCompleted: 0asnumber,//set the total number of tasks completed to 0
17
17
lastCompletionDate: undefinedasstring|undefined,//last completion date in YYYY-MM-DD string
18
18
},
19
19
},
20
20
getters: {
21
-
getTodos: (state)=>state.todos,//get a task list
21
+
getTodos: (state)=>state.todos,//get the task list
22
22
getXp: (state)=>state.user.xp,//get user XP
23
23
getLevel: (state)=>state.user.level,//get user level
24
24
getProgress: (state)=>state.user.progress,//get user level progress
@@ -27,7 +27,7 @@ export default createStore({
27
27
getTasksCompletedToday: (state)=>state.user.tasksCompletedToday,//get user tasks completed in a day
28
28
getTotalTasksCompleted: (state)=>state.user.totalTasksCompleted,//get user total tasks completed
29
29
getLastCompletionDate: (state)=>state.user.lastCompletionDate,//get user last completion date
30
-
getBestScoreEarned: (state)=>state.user.bestScoreEarned,//get the user best score earned when a task is completed
30
+
getBestScoreEarned: (state)=>state.user.bestScoreEarned,//get the user best score earned when the task is completed
31
31
},
32
32
mutations: {
33
33
/**
@@ -50,8 +50,8 @@ export default createStore({
50
50
(Number(newDate().setHours(23,59,59,999))-
51
51
Number(newDate()))/
52
52
(1000*24*60*60))
53
-
: 1+1/(daysToDue+1);//if a task is overdue, XP and score multiplier is less than 1 that decreases over time when a task is overdue, else XP multiplier bonus increases (more than 1) when a task gets closer to due date
54
-
letstreakMultiplier: number;//calculate task streak XP and score multiplier based on task streak, if a 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
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
54
+
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
55
letrepeatMultiplier: number;//calculate task repetition XP and score multiplier based on task repetition occurrence and task repetition frequency
56
56
letdailyStreakMultiplier: number;//calculate daily streak XP and score multiplier based on daily streak
57
57
letlevelMultiplier: number;//calculate level score multiplier based on user level
@@ -107,7 +107,7 @@ export default createStore({
107
107
//if task is overdue
108
108
task.streak=0;//reset task streak to 0
109
109
}else{
110
-
//if a task is completed before due date (not overdue)
110
+
//if the task is completed before due date (not overdue)
111
111
task.streak++;//increase task streak
112
112
}
113
113
//calculate daily streak
@@ -369,7 +369,7 @@ export default createStore({
369
369
}else{
370
370
activeTasksMultiplier=27;//27x active task score multiplier from 10,000 active tasks
371
371
}
372
-
//calculate the amount of XP earned and points earned when a task is completed
372
+
//calculate the amount of XP earned and points earned when the task is completed
373
373
constxpEarned: number=Math.max(
374
374
Math.floor(
375
375
task.difficulty*
@@ -401,7 +401,7 @@ export default createStore({
401
401
state.user.score+=pointsEarned;//get amount of points earned based on task difficulty, task priority, task due date, task repetition, task streak, daily streak and user level multipliers
402
402
if(pointsEarned>state.user.bestScoreEarned){
403
403
//if points earned are greater than the best score earned
404
-
state.user.bestScoreEarned=pointsEarned;//set the best score earned to points earned when a task is completed
404
+
state.user.bestScoreEarned=pointsEarned;//set the best score earned to points earned when the task is completed
0 commit comments