Creating A Streak Builder?

I’m creating an app in which I’d like to encourage users to develop a daily writing habit.

The Workflow currently looks like “When Multiline Input’s Value is changed” > Current User’s Streak = This User’s Streak + 1. (Part of the User data type).

I’m struggling to get the conditionals in place for this. I want this to operate similarly to Duolingo, where it’s based on calendar day. If a user writes something on each calendar day, then their Streak increases by 1. If they miss a day, then it resets to 0. Similarly, if they write more than once in a day, I don’t want the Streak counter to keep incrementing!

I have a Field in the User data type for LastWritingDate (Date), but I’m really struggling to get this one put together and I feel like I’m overthinking it!

Suggestions appreciated! :pray:

Sounds fun!

I would go for something like this (didn’t try though):

First, add a condition to the wkf multiline input has changed:

  • only when current date :rounded down to day is not last write :rounded down to day

Then, add a database trigger when increment changed

  • action set a recurring workflow, daily basis, start day current datetime rounded down to day +day 1, that make change to the increment = 0 (reset strike), only when increment after change > 0
  • action cancel a recurring workflow (frequency none), only when increment after change = 0

Ooohh interesting, thank you so much!

I’ll give this a go later today and report back. I suppose it might take a few days to understand if it works? :sweat_smile:

Thank you again!

Hi @cameronblack93, how is it going? :slightly_smiling_face:

Hey!

So I ran into a slight issue because I’m on the Starter Plan and already had a recurring workflow on the User data type for resetting their credits each month.

My work around has been:

For streak increment -

When multiline inputs value is changed → Current User Streak = This user’s streak + 1 Only When current date/time:extract day is not Current User’s LastWritingDate:extract day

For reset to 0 for missing 1 full calendar day -

When page is loaded → Current User Streak = 0 Only When current date/time:rounded down to day: extract date > Current User’s LastWritingDate +days: 1:extract date.

The reset workflow is present on every page that a logged in user might use in a session.

I’ve still to see if this works fully but I’m hopeful! :sweat_smile:

1 Like