From e9750353a74e8e83712849f674e93e9a2be80619 Mon Sep 17 00:00:00 2001 From: Keith Holliday Date: Tue, 30 May 2017 09:12:09 -0600 Subject: [PATCH 1/3] Set isDue and NextDue during sleep --- test/api/v3/unit/libs/cron.test.js | 18 ++++++++++++++++++ website/server/libs/cron.js | 20 ++++++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/test/api/v3/unit/libs/cron.test.js b/test/api/v3/unit/libs/cron.test.js index 0cf1845c69..6382b85a3d 100644 --- a/test/api/v3/unit/libs/cron.test.js +++ b/test/api/v3/unit/libs/cron.test.js @@ -313,6 +313,24 @@ describe('cron', () => { expect(tasksByType.dailys[0].completed).to.be.false; expect(user.stats.hp).to.equal(healthBefore); }); + + it('sets isDue for daily', () => { + let daily = { + text: 'test daily', + type: 'daily', + frequency: 'daily', + everyX: 5, + startDate: new Date(), + }; + + let task = new Tasks.daily(Tasks.Task.sanitize(daily)); // eslint-disable-line new-cap + tasksByType.dailys.push(task); + tasksByType.dailys[0].completed = true; + + cron({user, tasksByType, daysMissed, analytics}); + + expect(tasksByType.dailys[0].isDue).to.be.exist; + }); }); describe('todos', () => { diff --git a/website/server/libs/cron.js b/website/server/libs/cron.js index 2cc319e824..a7a64fae3d 100644 --- a/website/server/libs/cron.js +++ b/website/server/libs/cron.js @@ -16,6 +16,16 @@ const i18n = common.i18n; const loginIncentives = common.content.loginIncentives; // const maxPMs = 200; +function setIsDueNextDue (task, user, now) { + let optionsForShouldDo = cloneDeep(user.preferences.toObject()); + task.isDue = common.shouldDo(now, task, optionsForShouldDo); + optionsForShouldDo.nextDue = true; + let nextDue = common.shouldDo(now, task, optionsForShouldDo); + if (nextDue && nextDue.length > 0) { + task.nextDue = nextDue; + } +} + export async function recoverCron (status, locals) { let {user} = locals; @@ -108,6 +118,7 @@ function performSleepTasks (user, tasksByType, now) { } daily.completed = false; + setIsDueNextDue(daily, user, now); }); } @@ -316,14 +327,7 @@ export function cron (options = {}) { }); task.completed = false; - let optionsForShouldDo = cloneDeep(user.preferences.toObject()); - task.isDue = common.shouldDo(now, task, optionsForShouldDo); - optionsForShouldDo.nextDue = true; - let nextDue = common.shouldDo(now, task, optionsForShouldDo); - - if (nextDue && nextDue.length > 0) { - task.nextDue = nextDue; - } + setIsDueNextDue(task, user, now); if (completed || scheduleMisses > 0) { if (task.checklist) { From dea847ba1a9705e14e08675fdc9902524cb931f3 Mon Sep 17 00:00:00 2001 From: SabreCat Date: Tue, 30 May 2017 20:11:21 +0000 Subject: [PATCH 2/3] chore(news): Bailey --- website/views/shared/new-stuff.jade | 59 ++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/website/views/shared/new-stuff.jade b/website/views/shared/new-stuff.jade index 49446d5168..dbc6fb315f 100644 --- a/website/views/shared/new-stuff.jade +++ b/website/views/shared/new-stuff.jade @@ -1,35 +1,58 @@ -h2 5/25/2017 - MONTHLIES AND YEARLIES, CHALLENGES ON IOS, AND FLORAL HATCHING POTIONS +h2 5/30/2017 - HIRING MOBILE DEVELOPER; LAST CHANCE FOR FEATHERY GOODIES AND PARTY SURVEY hr tr td - .promo_floral_potions.pull-right - h3 Monthlies and Yearlies: New Repeating Options for Dailies - p Great news! We've added Repeatable Dailies, one of our most-requested features. Now you can set a Daily task to be due at any interval you choose, including on a specific day of the month or year! Repeatables will be available on the Habitica website, as well as on our iOS and Android apps! We hope this helps you get even more out of your Dailies list. Enjoy your added productivity! - p.small.muted by TheHollidayInn, Alys, and all our awesome testers! + h3 Hiring Mobile Developer! + p Want to join the Habitica team? We’re looking to hire a new mobile contractor! + br + p We’re particularly interested in people who have a good understanding of either Android development or iOS development, including knowledge of ObjC and Swift. Bonus points if you also have experience with: Core Data, Reactive Programming (ReactiveCocoa/RxJava), Realm, and Kotlin, as well as familiarity with iOS and/or Android UI design principles, patterns, and best practices. Our ideal dev would be eager to push the limits of what our apps can currently do, with an eye for details, a drive to make their work both technically and visually sound, and an interest in expanding their knowledge of current advancements in the field. Diverse candidates are encouraged to apply! + br + p To apply, send an email to vicky@habitica.com with a CV that includes your experience with the items listed above, your Habitica username, and your favorite nerdy pursuit. We can’t wait to hear from you! + p.small.muted by the Habitica Team tr td - h3 iOS Update: Challenges and Bug Fixes - p We've released a new iOS update! + h3 Last Chance for Feathered Fighter Set and Feathered Friends Pet Quest Bundle + p Reminder: tomorrow is the final day to subscribe and receive the Feathered FIghter Set! Subscribing also lets you buy gems for gold. The longer your subscription, the more gems you get! You'll also receive the exclusive Jackalope Subscriber pet! Thanks so much for your support! You help keep Habitica running. br - p Now iOS users can view, join, and leave Challenges via the Habitica app! Easily add user-created tasks to your list, then compete against other Habiticans to win gems and achievements. We've also smashed some bugs including the issue where Dailies would not always be saved on iOS 8 and 9 and a fix for the crashes some users were experiencing when using To-Dos and checklists. - br - p We hope you enjoy the update! Be sure to download it now for a better Habitica experience! - br - p If you like the improvements that we’ve been making to our app, please consider reviewing this new version. It really helps us out! Old reviews get hidden with each update, but if you go to the review section you can re-post them again with a single tap. - p.small.muted by viirus + p It's also the last day to purchase the Feathered Friends Pet Quest Bundle and receive the Parrot, Owl, and Falcon quests, all for only 7 gems! That's a discount of 5 gems from the price of purchasing them separately. Check out this deal in the Quest Shop before it flies away! + p.small.muted by Lemoness tr td - h3 Floral Hatching Potions - p Floral Magic Hatching Potions are back! Between now and June 14, you can buy them from the Market and use them to hatch any standard pet egg. (Magic Hatching Potions do not work on Quest Pet eggs.) Floral Potion Pets aren't picky, so they'll happily eat any kind of food that you feed them! - br - p After they're gone, it will be at least a year before the Floral Hatching Potions are available again, so be sure to get them now! - p.small.muted by Mako413 and SabreCat + .achievement-guild2x.pull-left.slight-right-margin + h3 Last Chance for Party Usage Survey + p Tomorrow is the last day to tell us more about how your Party uses the text features on your Party page and earn the Helped Habitica Grow badge! Click here to take the brief survey! + p.small.muted by Sara Olson if menuItem !== 'oldNews' hr a(href='/static/old-news', target='_blank') Read older news mixin oldNews + h2 5/25/2017 - MONTHLIES AND YEARLIES, CHALLENGES ON IOS, AND FLORAL HATCHING POTIONS + tr + td + .promo_floral_potions.pull-right + h3 Monthlies and Yearlies: New Repeating Options for Dailies + p Great news! We've added Repeatable Dailies, one of our most-requested features. Now you can set a Daily task to be due at any interval you choose, including on a specific day of the month or year! Repeatables will be available on the Habitica website, as well as on our iOS and Android apps! We hope this helps you get even more out of your Dailies list. Enjoy your added productivity! + p.small.muted by TheHollidayInn, Alys, and all our awesome testers! + tr + td + h3 iOS Update: Challenges and Bug Fixes + p We've released a new iOS update! + br + p Now iOS users can view, join, and leave Challenges via the Habitica app! Easily add user-created tasks to your list, then compete against other Habiticans to win gems and achievements. We've also smashed some bugs including the issue where Dailies would not always be saved on iOS 8 and 9 and a fix for the crashes some users were experiencing when using To-Dos and checklists. + br + p We hope you enjoy the update! Be sure to download it now for a better Habitica experience! + br + p If you like the improvements that we’ve been making to our app, please consider reviewing this new version. It really helps us out! Old reviews get hidden with each update, but if you go to the review section you can re-post them again with a single tap. + p.small.muted by viirus + tr + td + h3 Floral Hatching Potions + p Floral Magic Hatching Potions are back! Between now and June 14, you can buy them from the Market and use them to hatch any standard pet egg. (Magic Hatching Potions do not work on Quest Pet eggs.) Floral Potion Pets aren't picky, so they'll happily eat any kind of food that you feed them! + br + p After they're gone, it will be at least a year before the Floral Hatching Potions are available again, so be sure to get them now! + p.small.muted by Mako413 and SabreCat h2 5/23/2017 - MAY SUBSCRIBER ITEMS, DEVELOPER BLOG POST, GUILD ACHIEVEMENT, AND PARTY SURVEY tr td From 5fbec4069ec5a7d8c855c607a18393b2e3827107 Mon Sep 17 00:00:00 2001 From: SabreCat Date: Tue, 30 May 2017 20:59:24 +0000 Subject: [PATCH 3/3] 3.93.2 --- npm-shrinkwrap.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 0fdf5ee0ad..80691cb3fa 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "habitica", - "version": "3.93.1", + "version": "3.93.2", "dependencies": { "@gulp-sourcemaps/map-sources": { "version": "1.0.0", diff --git a/package.json b/package.json index a5bacc4983..a272db8ca8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "habitica", "description": "A habit tracker app which treats your goals like a Role Playing Game.", - "version": "3.93.1", + "version": "3.93.2", "main": "./website/server/index.js", "dependencies": { "@slack/client": "^3.8.1",