Habits v2: adding counter to habits (cleaned up branch) - fixes #8113 (#8198)

* Clean version of PR 8175

The original PR for this was here:
https://github.com/HabitRPG/habitica/pull/8175

Unfortunately while fixing a conflict in tasks.json, I messed up the rebase and wound up pulling in too many commits and making a giant mess. Sorry. :P

* Fixing test failure

This test seems to occasionally start failing (another coder reported the same thing happening to them in the blacksmiths’ guild) because the order in which the tasks are created can sometimes not match the order in the array. So I have sorted the tasks array after creation by the task name to ensure a consistent ordering, and slightly reordered the expect statements to match.
This commit is contained in:
astolat
2017-02-27 13:15:45 -05:00
committed by Keith Holliday
parent 6f0d0b1fb3
commit 6d0df78441
13 changed files with 150 additions and 2 deletions

View File

@@ -214,6 +214,9 @@ let dailyTodoSchema = () => {
export let HabitSchema = new Schema(_.defaults({
up: {type: Boolean, default: true},
down: {type: Boolean, default: true},
counterUp: {type: Number, default: 0},
counterDown: {type: Number, default: 0},
frequency: {type: String, default: 'daily', enum: ['daily', 'weekly', 'monthly']},
}, habitDailySchema()), subDiscriminatorOptions);
export let habit = Task.discriminator('habit', HabitSchema);