mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-16 08:52:17 +00:00
replace _.times with for loop to allow break
This commit is contained in:
parent
c3d65f0bcf
commit
06fd9c7a67
1 changed files with 13 additions and 15 deletions
|
|
@ -1749,22 +1749,20 @@ api.wrap = (user, main=true) ->
|
|||
dailyChecked += 1
|
||||
else
|
||||
# dailys repeat, so need to calculate how many they've missed according to their own schedule
|
||||
console.log("task: " + task.text) # XXX Alys to remove these
|
||||
console.log("---- task: " + task.text) # XXX Alys to remove these
|
||||
scheduleMisses = 0
|
||||
keepGoing = true # XXX Alys to improve how we break out of _.times
|
||||
_.times daysMissed, (n) ->
|
||||
if keepGoing
|
||||
console.log("n: " + n)
|
||||
thatDay = moment(now).subtract({days: n + 1})
|
||||
if api.shouldDo(thatDay.toDate(), task, user.preferences)
|
||||
console.log("damage")
|
||||
scheduleMisses++
|
||||
if user.stats.buffs.stealth
|
||||
user.stats.buffs.stealth--
|
||||
EvadeTask++
|
||||
if multiDaysCountAsOneDay
|
||||
console.log("end")
|
||||
keepGoing = false
|
||||
for n in [0...daysMissed]
|
||||
console.log("n: " + n)
|
||||
thatDay = moment(now).subtract({days: n + 1})
|
||||
if api.shouldDo(thatDay.toDate(), task, user.preferences)
|
||||
console.log("damage")
|
||||
scheduleMisses++
|
||||
if user.stats.buffs.stealth
|
||||
user.stats.buffs.stealth--
|
||||
EvadeTask++
|
||||
if multiDaysCountAsOneDay
|
||||
console.log("end")
|
||||
break
|
||||
|
||||
if scheduleMisses > EvadeTask
|
||||
perfect = false
|
||||
|
|
|
|||
Loading…
Reference in a new issue