Added support in daily tasks for specifying ’every X days’ and ‘every X weeks on specific days of the week’.

- shouldDo() now takes the entire task as an input instead of just the ‘repeat’ (days of the week) dictionary.
- the ‘start’ date for a task can be specified (and can also be in the future, in which case it will be greyed out until then.) ‘start’ date also affects ‘every X days’ and ‘every X weeks’.
- no migration code yet.
This commit is contained in:
Allen Pan
2015-05-07 15:23:54 -07:00
parent 2ba1a1fc85
commit 1ecf608408
5 changed files with 122 additions and 24 deletions

View File

@@ -50,10 +50,14 @@ var checklist = [{
var DailySchema = new Schema(
_.defaults({
type: {type:String, 'default': 'daily'},
type: {type: String, 'default': 'daily'},
//TODO: Cleaner to store interval as enum instead of str?
frequency: {type: String, 'default': 'daily'}, // 'daily', 'weekly'
everyX: {type: Number, 'default': 1}, // e.g. once every X weeks
startDate: {type: Date},
history: Array,
completed: {type: Boolean, 'default': false},
repeat: {
repeat: { // used only for 'weekly' frequency, TODO: Rename to daysOfWeek or something with 'week'
m: {type: Boolean, 'default': true},
t: {type: Boolean, 'default': true},
w: {type: Boolean, 'default': true},