mcuapi icon indicating copy to clipboard operation
mcuapi copied to clipboard

Suggestion: Chronology for shows

Open deBasMan21 opened this issue 3 years ago • 3 comments

Currently the movies have a chronology property with a number to order them chronologically. I would also like this property on the tv shows so all the projects can be ordered by that one property. I would love to hear if this is possible in some way.

deBasMan21 avatar Apr 09 '23 11:04 deBasMan21

Hi, @deBasMan21. It's possible. I thought about this long ago, but I'm not 100% sure how to do it. I had plans to make one endpoint where all productions (movies and tv shows) are returned. However, each model is located in a different table. So I need to implement a strategy to add a chronology number that would be easy to change since each future production can be located in different places on the timeline.

AugustoMarcelo avatar Apr 18 '23 11:04 AugustoMarcelo

@AugustoMarcelo Do you use any CMS or do you add the data directly into the db? If you use a CMS this would maybe be a good place to add some logic to make a GUI to drag and drop items and get the according index to save it in the db.

If thats not the case you could create a simple sql script that updates all the indices of the projects with a higher index than the new project with +1. Since there aren't a lot of projects being added this isn't really a big performance problem. It could be something like:

UPDATE projects 
SET chronology = chronology + 1 
WHERE chronology >= <<newProjectIndex here>>

Let me know if i can help you in any way :)

deBasMan21 avatar Apr 18 '23 12:04 deBasMan21

@deBasMan21 Today I just update the data directly in the DB. I understood your solution, but it's not possible to be done today because movies and tv shows are stored in different tables. I can just add a new field to the tv show model and create a chronology between them (tv shows). But if I want to do a global endpoint to return both sorted chronologically, the tv shows will not be placed correctly. I think the solution may be to use a float number in the tv shows. So if it's placed between the movie 1 and 2 (chronologically speaking) it could be stored with 1.1 or something like this.

AugustoMarcelo avatar May 04 '23 17:05 AugustoMarcelo