sort numbers & build the season string in the frontend (#306)

This commit is contained in:
Kilian von Pflugk 2024-09-22 13:30:35 +02:00 committed by GitHub
parent f83a32e7dd
commit eaee1ac842
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 9 deletions

View File

@ -1032,7 +1032,7 @@
// add all seasons from this show to the season select
for (const season in shows[selectShow.value].Seasons) {
addItem(selectSeason, shows[selectShow.value].Seasons[season], season);
addItem(selectSeason, "Season " + shows[selectShow.value].Seasons[season], season);
}
selectSeason.value = "";

View File

@ -44,14 +44,14 @@ public class VisualizationController(ILogger<VisualizationController> logger) :
var seriesId = first.SeriesId;
var seasonId = kvp.Key;
var seasonName = GetSeasonName(first);
var seasonNumber = first.SeasonNumber;
if (!showSeasons.TryGetValue(seriesId, out var showInfo))
{
showInfo = new ShowInfos { SeriesName = first.SeriesName, ProductionYear = GetProductionYear(seriesId), LibraryName = GetLibraryName(seriesId), Seasons = [] };
showSeasons[seriesId] = showInfo;
}
showInfo.Seasons[seasonId] = seasonName;
showInfo.Seasons[seasonId] = seasonNumber;
}
}
@ -288,11 +288,6 @@ public class VisualizationController(ILogger<VisualizationController> logger) :
return NoContent();
}
private static string GetSeasonName(QueuedEpisode episode)
{
return "Season " + episode.SeasonNumber.ToString(CultureInfo.InvariantCulture);
}
private static string GetProductionYear(Guid seriesId)
{
return seriesId == Guid.Empty

View File

@ -26,6 +26,6 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper.Controllers
/// <summary>
/// Gets the Seasons of the show.
/// </summary>
public required Dictionary<Guid, string> Seasons { get; init; }
public required Dictionary<Guid, int> Seasons { get; init; }
}
}