From 99bc09fb2528982cc0b47903335325951ca32112 Mon Sep 17 00:00:00 2001 From: Alys Date: Wed, 24 Jun 2015 14:18:16 +1000 Subject: [PATCH] move dayOfWeekNum to correct scope and improve comment --- common/script/index.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/script/index.coffee b/common/script/index.coffee index f229ae6de6..61649f3d0f 100644 --- a/common/script/index.coffee +++ b/common/script/index.coffee @@ -82,7 +82,6 @@ api.shouldDo = (day, dailyTask, options = {}) -> dailyTask.startDate = moment(dailyTask.startDate).toDate() o = sanitizeOptions options day = api.startOfDay(_.defaults {now:day}, o) - dayOfWeekNum = day.day() # e.g. 1 for Monday if week starts on Mon if day < api.startOfDay(_.defaults {now:dailyTask.startDate}, o) return false # Daily starts in the future @@ -96,6 +95,7 @@ api.shouldDo = (day, dailyTask, options = {}) -> else if dailyTask.frequency == 'weekly' if !dailyTask.repeat return false # error condition + dayOfWeekNum = day.day() # e.g. 0 for Sunday dayOfWeekCheck = dailyTask.repeat[api.dayMapping[dayOfWeekNum]] return dayOfWeekCheck else