How to implement a logic where "x only occur when within this 7 days, the user complete 1 workout"

Hi guys

I have a feature where I am counting user streak, and having trouble as each time a workout is done, the number go up by one. How can I solve this?

The desired action would be:

During this 7 days, for the first workout they do, the streak go up by 1, and for the rest of week no matter how much workout they do the streak stay the same, however after 7 days, the first workout them do the streak go up by 1 again, and same for the rest of the workout for the reast of the week where no number is changed.

Any response would be appreciated

Best
Max

1 Like

You just need to know the date when you add a streak (Set a field on the user called: Streak Update Date) , then, set a conditional on streak addition flow like –

Only whenCurrent Date/Time - Streak Update Date``: formatted as Days > 7

Hey there, thanks for this but currently I am counting the streak with the workout they are completed, something like this, however seem like it is not working. (I was trying to do something like if for the past 7 days the user complete the workout then add a streak, however now it is adding every time when a user complete one workout)

I don’t understand why you’re trying to complicate it so much!

Maybe just fetch the latest workout’s date and see how many days ago it was?

With your existing approach the first thing I’d do is check or create privacy rules so they can see the existing workouts, otherwise it will always return <= 1

Yes I might try that, thank you!

There is likely a much simpler way to do this, and avoid some WU … but in your example I think you just have a simple logic bug. I think you need greater than , not less than.

Screenshot 2023-10-12 at 10.21.42

This topic was automatically closed after 70 days. New replies are no longer allowed.