Get the next record

Hello guys.

I’m developing a course app.
The courses will be divided by episodes.
And the student’s advancement will occur at the end of each episode.

Example:
The student watched the video of “episode 1” and at the end of the video “episode 2” is available and so on.

The plugin I’m using offers the option to do an action after the video is complete.

What I need is to take the next episode and register it in the “completed episodes of the user” field in the user table. But for that I would need to get the next id not the current episode id.

I’m grateful for any help.

What determines the “next episode”? Do you have a list in a set order, or do your videos have a number field indicating which order they are in?

Hello how are you?
I have the episodes registered. And I do a search for the course of these episodes.

I don’t know if I answered your question.

First you should think about the use of lists for this case.
How many courses will be?
How many episodes?

Because if a user has too many completed courses or episodes over the time, the app performance when working with these lists would be compromised.

Otherwise, you can just keep using it the way you’re doing, but as mentioned above, your episodes should have a numerical sequence, let’s say, ORDER (number). That way each course will have episode 1 (ORDER = 1) already available and when finished it will be added to the list of completed episodes and you can make the next episode available by adding the next episode (Current episode’s order + 1) to the list of available episodes.

1 Like

I understand about the lists.
But how could I do this route without using lists?
Instead of the user having an episode list, couldn’t the episodes have the user lists?

Regardless how you manage the “Watched videos” list, you’ll need a number field under the video so you can find the current video and + 1 to get the next one like @Newed said.

1 Like

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