Issue using the “Update” feature with a joint table

Hi,

I create a meditation app with audios:

  • There is a list of programs (screen 1)
  • When a user clicks on a program, he has a list of songs (screen 2)
  • When he clicks on a song, he is redirected to the audio player (screen 3)

I have the following collections:

  • Users
  • Songs
  • Programs
  • Listened Songs → each line represents a song listened by a user
  • Listened Programs → each line represents a program listened by a user (ie the user has listened all the songs of this program)

Listened Songs and Listened Programs are joint tables
(with Users, Songs, Programs, Listened Programs for Listened Songs ; and with Users, Songs, Programs, Listened Songs for Listened Programs)

Here is the process:

Here is the app in case: test

Thanks a lot in advance

Hi Gary,

J’aimerai comprendre une chose stp,
pourquoi créer une collection pour “chansons écoutées” et “programme écoutés”?
cela va alourdir la base de données à long terme,

sauf si tu as vraiment besoin de ça, dans quel cas de figure est-ce nécessaire?

Bonjour,

Il s’agit d’une table jointe pour savoir pour chaque user les chansons qu’il a déjà écouté pour ensuite les marqués dans l’app comme “déjà écouté”, idem pour les programmes

Est-ce que c’est plus clair ? :slight_smile:

oui totalement plus clair,
mais il y’a une façon beaucoup plus simple et optimal pour le faire,
il suffit de rajouter une relation (user-song) many to many “listened songs” achque fois qu’une chanson est jouée, “add action> update logged-in user > listend songs> Add current song” et c’est bon,
pas la peine d’en faire une collection entière pour rien

1 Like

Merci beaucoup c’est beaucoup plus optimal effectivement, je n’avais pas du tout pensé à cette méthode !

C’est parfait du coup, vraiment merci ! :slight_smile:

Hi @Benalihoussam
I have a podcast application, where users can listen to podcast.
Having 3 tables mainly
i) Users
ii) Podcasts
iii) Listening track

I would like to track how much A USER has listened A PODCAST and have a record of the same. I tried using the audio player settings by using played seconds and played proportion but the record is not getting created in the first click itself, it is getting created only in the second click, this seems to be an issue.

So I tried doing the below and would like to have an understanding on how it works.
Action 1: Create a record in Listening track with start time
Action 2: If the user pause, update same record with end time & duration listened by subtracting current time minus start time. This way we get the duration listened for the podcast. (applicable if the audio ends and press back button)

(Every time user press play button start time gets updated and when pressed pause end time updated and added to the duration listened)
I’m not able to get the 2nd action (update) right, i tried the relationships but i’m missing some where.

Ideally what I want to get right is if a podcast is for 20 minutes, I want to check if the user has listened a podcast for 20 minutes, if yes give 10 points to the users table

Hi aspire,
can you provide some screenshots on how the actions are on the buttons?

Hi @Benalihoussam

Sure here it is.

Im kind of trying to create a record if the podcast is playing for first time by putting current time.
When paused, update the row by end time & subtract the current time from end time to calculate the time listened and save it in same row
When again user play podcast update the same record with start time, when paused repeat the above step and add the duration already listened.