HabitRPG / habitica

A habit tracker app which treats your goals like a Role Playing Game.
https://habitica.com
Other
11.81k stars 4.05k forks source link

scheduling bug for Dailies set to repeat "daily", everyX > 1 #13047

Open Alys opened 3 years ago

Alys commented 3 years ago

The bug report below is for Dailies that are not being scheduled correctly on the iOS app (in the main task list and the RYA screen), but are being scheduled correctly on the website. It's possible that this is not an app bug but instead is a bug with how the API sets the isDue field on a Daily (that field is not used by the website).

@phillipthelen Can you please tell me if the app uses the isDue field for determining whether to display a Daily as scheduled, or if it does its own calculations? Or a mixture of both?

If the app uses only the isDue field and never does it's own calculations, I'll move this to the main repo and do a more investigation into the API.


The following quotes are from @haaaars (75200c6f-2c27-4fb8-a784-f7209e0f0dc6), taken from various emails over several days, with minor edits to assist with following the issue.

"I have a daily that is set to recur every third day. Much of the time it works properly. Sometimes this task is not illuminated during a day, but then shows next morning in the 'check off dailies you missed' alert. This happened today, so wanted to report when I had a concrete example. Thanks for making a great app!"

"I had similar challenges with setting up monthly and weekly [dailies], so have translated some back into 'daily every ... days.''

"I am checking in every day"

"If memory serves, I created the [dailies] initially on my phone and then tweaked them via web when the app alerted me daily, or more frequently than I had intended when using weekly or monthly settings."

"I created a test daily, starting Sept 24, [due] every three days."

"I haven't experienced this bug on web, just on the iOS app. I'm keeping an eye out for a recurrence. I did both my original 'water plans' daily and the 'test' daily yesterday, so we'll see if they pop up again out of turn."

"This morning, both the test daily and 'water plants' popped up as dailies undone yesterday - though they were not due yesterday. So, it looks like the test replicated the error of the original."

Here are the relevant settings from the test Daily:

{
    "_id": "F5B19620-01A4-4AB6-8FE0-28EAEC139A08",
    "repeat": { "m": true, "t": true, "w": true, "th": true, "f": true, "s": true, "su": true },
    "challenge": {},
    "group": { ... }, // not a group task
    "frequency": "daily",
    "everyX": 3,
    "streak": 6,
    "nextDue": [
        "Sat Nov 14 2020 00:00:00 GMT-0600",
        "Tue Nov 17 2020 00:00:00 GMT-0600",
        "Fri Nov 20 2020 00:00:00 GMT-0600",
        "Mon Nov 23 2020 00:00:00 GMT-0600",
        "Thu Nov 26 2020 00:00:00 GMT-0600",
        "Sun Nov 29 2020 00:00:00 GMT-0600"
    ],
    "yesterDaily": true,
    "type": "daily",
    "daysOfMonth": [],
    "reminders": [],
    "checklist": [],
    "weeksOfMonth": [],
    "text": "Test Daily",
    "startDate": "2020-09-24T21:45:05.000Z",
    "createdAt": "2020-10-29T21:45:25.654Z",
    "updatedAt": "2020-11-13T14:53:25.730Z",
    "userId": "75200c6f-2c27-4fb8-a784-f7209e0f0dc6",
    "isDue": false,
}

The following lines help us find and squash the Bug you encountered. Please do not delete/change them. iOS Version: 14.2 Device: iPhone 8 Plus App Version: 3.1 (524) User ID: 75200c6f-2c27-4fb8-a784-f7209e0f0dc6 Level: 25 Class: rogue Is in Inn: false Uses Costume: false Custom Day Start: 0

phillipthelen commented 3 years ago

The apps both use the isDue field and don't do their own calculations. Only exception from this would be the RYA modal where the dailies to display are pulled from the server and the apps provide the date for the previous day. (there is a bug where the day the apps send to the server is the wrong one but that doesn't seem to be this bug)

Alys commented 3 years ago

I've looked into the client and server isDue code in the website. The website uses the isDue field itself to decide which Dailies to display as due so I think this may be an app bug after all ("I haven't experienced this bug on web, just on the iOS app.").

Is it possible the app is caching data and not picking up the latest value of isDue?


Unrelated to that, isDue is calculated for each Daily during cron, so when cron fails part way through, isDue wouldn't be updated for some or all Dailies, meaning that they may not be scheduled correctly until after the next cron. If we see reports of Dailies not being scheduled correctly on both website and app, it may be due to this.

veeeeeee commented 3 years ago

@shanaqui has reported that this is happening on web as well so we've transferred this to the main repo to make sure we don't lose track of it there.

SeanCKeefe13 commented 1 year ago

Hello, I am attempting to break into the open source side of the coding world. Is this task still open, if so I'd like to see if I could fix this.

CuriousMagpie commented 1 year ago

Hi @SeanCKeefe13, welcome to open source! And this issue is all yours, if you still want it.

djk447 commented 9 months ago

This may be slightly off topic as my dailies are scheduled for every day, but I'm still running into bugs with them.

I think I am running into this issue where perhaps a cron isn't running or intermittently isn't running along with sometimes slow updates to the IOS app, right now my dailies aren't updating correctly, on both mobile and web and I've had some issues before where they're just having trouble in IOS.

One big thing to do here, it seems to me, is to not use the isDue field or have switch about when that is calculated so that we just use the nextDue field and the current time, then we don't need to have the interaction where that is calculated? Maybe could also store the last completed time in the task so that we can always calculate if we're meant to be in the due state?

But I don't know the project well, I'm a developer and a user, it is just really frustrating to wake up in the morning to do my dailies and have them take forever to update, it seems like their state could just be determined by knowing when they were last done, and what time it is now rather than waiting for the backend to do that and would make for a much better user experience.