When all Episodes of a Program are listened, Program is completed

Hi,

I am creating a meditation app. I have Programs, each Program has several Episodes.

I would like to have the information in database when a Program is completed (ie when all Episodes of the Program have been listened).

Do you have any idea how I could do?

Thanks in advance :slight_smile:

Hi @gary ,

In episodes collection, add numbers field and update to 1 if completed, then to check if all episodes in that program are completed use current program>episodes>numbers>sum equal to current program>episodes>numbers>count.

So count will tell how many episodes and sum will tell how many that are equal to 1 which is completed.

2 Likes

Thank you for the solution! The only problem is that I don’t know where (which screen and which component) to check if all episodes in that program are completed (by indeed using current program>episodes>numbers>sum equal to current program>episodes>numbers>count)

→ I have 2 screens:

  • The first one with the list of episodes
    The second one with the audio player when I click on an episode

I have put the following rules in the audio player:

  • Adding an andio in the Listened audios Collection when an audio is listened for the first time
  • Adding a program in the Listened programmes Collection when all audios of a programma are listened (by using current program>episodes>numbers>sum equal to current program>episodes>numbers>count)

The thing is when all audios are listened, the program is not added to the Listened programmes Collection, I need to listen again one audio so the program can be added to the Listened programmes Collection

Thank you in advance :slight_smile:

Hi @gary ,

You could mark an episode completed action before link to the next screen or you can use countdown with few seconds located in the next screen to mark completed. Probably more ways that you can experiment to make it more sense for users.
Even you can have button below the audio player that says completed.

And for checking sum=count, you can do that whenever user go back from next screen, it takes a bit delay to get sum and count, because these are calculated fields, need further checking in database, so for user experience separate their process between marking and checking.

1 Like

Thank you for the suggestions, I am going to try them :slight_smile:

“you can use countdown with few seconds located in the next screen to mark completed” → you mean the countdown component?

When I use the “button below the audio player that says completed”, it works for 1 action (example: marking an audio as listened) but not for 2 actions (example: marking an audio as listened + marking a program as listened when all audios are listened), probably because it does both actions at the same time

Thank you for the last advice

Yes, that one, it is our frontend workflow.

yes, it needs more time to get the sum, so if you are using button to mark you put action to check sum when user link back.

1 Like

ok thanks a lot

1 Like