Merge remote-tracking branch 'upstream/main' into feature-testing

Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
Tim Hårek Andreassen 2024-04-08 18:53:59 +02:00
commit d9480096f5
No known key found for this signature in database
GPG Key ID: E59C7734F0E10EB5
1 changed files with 5 additions and 1 deletions

View File

@ -23,7 +23,7 @@ type UpdatedSeries = {
lastFetch: Date;
episodes: Episode[];
} & Series;
async function updateFetch(existingSeries: Series): Promise<UpdatedSeries | null> {
async function updateFetch(existingSeries: Series): Promise<UpdatedSeries | Series | null> {
const series = await nrkRadio.getSeries(existingSeries.id);
if (!series) {
return null;
@ -32,6 +32,10 @@ async function updateFetch(existingSeries: Series): Promise<UpdatedSeries | null
return !existingSeries.episodes.find((serieEpisode) => serieEpisode.id === episode.id);
});
if (newEpisodes.length === 0) {
return existingSeries;
}
/**
* Since we don't control the API,
* we should not make assumptions about the order,