mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-14 07:52:15 +00:00
Fix: reset streak for habits after rebirth (#11345)
* Fix: reset streak for habits after rebirth - Modify current test of reseting streaks - Add new if branch for task with "habit" type * Fix: reset habits by another keys (counterDown/counterUp): - Fix test for correct way of reseting habits - Use another keys for reseting habits
This commit is contained in:
parent
7219aa963b
commit
65906f0b71
2 changed files with 8 additions and 0 deletions
|
|
@ -86,10 +86,14 @@ describe('shared.ops.rebirth', () => {
|
|||
});
|
||||
|
||||
it('resets user\'s daily streaks to 0', () => {
|
||||
tasks[0].counterDown = 1; // Habit
|
||||
tasks[0].counterUp = 1; // Habit
|
||||
tasks[1].streak = 1; // Daily
|
||||
|
||||
rebirth(user, tasks);
|
||||
|
||||
expect(tasks[0].counterDown).to.equal(0);
|
||||
expect(tasks[0].counterUp).to.equal(0);
|
||||
expect(tasks[1].streak).to.equal(0);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ module.exports = function rebirth (user, tasks = [], req = {}, analytics) {
|
|||
if (task.type === 'daily') {
|
||||
task.streak = 0;
|
||||
}
|
||||
if (task.type === 'habit') {
|
||||
task.counterDown = 0;
|
||||
task.counterUp = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue