Log when there is no releaseDate for a serie

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-04-23 16:28:48 +02:00
parent 0c3b237fb8
commit d5638674a2
Signed by: Florian Bouillon
GPG Key ID: 50BD648F12C86AB6

View File

@ -7,10 +7,11 @@ export async function getSeries(): Promise<Array<Serie>> {
const series = await Promise.all((await smartGlob('./db/data/*.js'))
.map((it) => it.substring(it.lastIndexOf('/') + 1, it.length - 3))
.map((it) => getSerie(it)))
const tmp: Array<[Serie, Set]> = await Promise.all(series.map( async (it) => {
const tmp: Array<[Serie, Set | undefined]> = await Promise.all(series.map( async (it) => {
return [it, (await getSets(it.name.en)).reduce<Set | undefined>((p, c) => p ? p.releaseDate < c.releaseDate ? p : c : c, undefined) as Set] as [Serie, Set]
}))
return tmp.sort((a, b) => a[1].releaseDate > b[1].releaseDate ? 1 : -1).map((it) => it[0])
tmp.forEach((t) => !t[1] && console.log(t[0].name) )
return tmp.sort((a, b) => (a[1] ? a[1].releaseDate : '0') > (b[1] ? b[1].releaseDate : '0') ? 1 : -1).map((it) => it[0])
}
export async function getSerie(name: string): Promise<Serie> {