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:
Xaz16
2019-09-04 17:52:38 +03:00
parent 3797d29835
commit 42687335af
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -86,12 +86,14 @@ describe('shared.ops.rebirth', () => {
});
it('resets user\'s daily streaks to 0', () => {
tasks[0].streak = 1; // Habit
tasks[0].counterDown = 1; // Habit
tasks[0].counterUp = 1; // Habit
tasks[1].streak = 1; // Daily
rebirth(user, tasks);
expect(tasks[0].streak).to.equal(0);
expect(tasks[0].counterDown).to.equal(0);
expect(tasks[0].counterUp).to.equal(0);
expect(tasks[1].streak).to.equal(0);
});
+2 -1
View File
@@ -48,7 +48,8 @@ module.exports = function rebirth (user, tasks = [], req = {}, analytics) {
task.streak = 0;
}
if (task.type === 'habit') {
task.streak = 0;
task.counterDown = 0;
task.counterUp = 0;
}
}
});