Add planning to shows and movies in one merged grid
This commit is contained in:
1 parent
cd9a8a186a
commit
d473aebb79
9 files changed
+56
-41
No files matched your search
@@ -61,12 +61,14 @@ export function bookStats(books: Book[]): BookStats | null {
|
||||
export function screenStats(titles: RatedTitle[]): ScreenStats {
|
||||
const ratings = titles.flatMap((title) => (title.rating === undefined ? [] : [title.rating]));
|
||||
const watching = titles.filter((title) => title.status === 'watching').map((title) => title.name);
|
||||
const planningCount = titles.filter((title) => title.status === 'planning').length;
|
||||
const groups = new Set(titles.flatMap((title) => (title.collection ? [title.collection] : [])));
|
||||
|
||||
return {
|
||||
rows: [
|
||||
{ label: 'Titles', value: `${titles.length}` },
|
||||
{ label: 'Watching', value: `${watching.length}` },
|
||||
{ label: 'Planning', value: `${planningCount}` },
|
||||
{ label: 'Groups', value: `${groups.size}` },
|
||||
{ label: 'Avg rating', value: average(ratings) }
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user