EmotionCognitionLab / pvs

1 stars 0 forks source link

Fix streak calculation #306

Closed noah10 closed 1 year ago

noah10 commented 1 year ago

To calculate the length of a streak we need to sort the dates the user has done everything and then find the longest stretch of consecutive days, starting from yesterday and working backwards, that the user has done all of his or her breathing exercises.

There are currently two bugs here:

  1. We comparing the dates backwards, so an unbroken streak looks like [-1, -1, -1, -1...] days when it should be [1, 1, 1, 1, ...] .
  2. We aren't starting from yesterday, so a user who practiced on [2022-11-04, 2022-11-03, 2011-11-02] and then didn't log in again until 2022-12-09 would see a 3 day streak when they should see no streak.
noah10 commented 1 year ago

@cho890 could you try this out and see if it seems to be working correctly for you now?

cho890 commented 1 year ago

The 3 is still grayed out for me. The completion star #5 is still in color.

noah10 commented 1 year ago

Is that using the version of the app that was released 12/19/22 ? If not, please test it with that one.

cho890 commented 1 year ago

I missed that update. With the most recent app version, I see the 3 in the streak in color now.