adjust cron so that it prevents a double cron when timezone decreases (timezoneOffset increases)

* start to fix cron for when timezones change

* add some incomplete code

* change cron to identify when timezone changes and run only if both zones agree it should run - BAD - does cron an hour early one day later

* change timezone offset variable names

* improve handling of each individual timezone change possibility

* remove unnecessary casting to number

* remove duplicated code

* finish code for dangerous timezone change

* fix linting errors

* remove console.log lines and other testing code

* add a TODO comment for further actions for timezone changes in the "safe" direction
This commit is contained in:
Alys
2016-04-02 11:42:15 +10:00
parent 41b3ee1df0
commit 0ba47de43d
4 changed files with 98 additions and 8 deletions
+1 -1
View File
@@ -373,7 +373,7 @@ api.update = (req, res, next) => {
api.cron = function(req, res, next) {
var user = res.locals.user,
progress = user.fns.cron({analytics:utils.analytics}),
progress = user.fns.cron({analytics:utils.analytics, timezoneOffset:req.headers['x-user-timezoneoffset']}),
ranCron = user.isModified(),
quest = shared.content.quests[user.party.quest.key];