From 903d841b1783012e0939ce54026ac30c3a843463 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Mon, 20 May 2024 15:52:23 -0700 Subject: [PATCH] fix: listening totals --- package-lock.json | 4 ++-- package.json | 2 +- src/_data/music.js | 9 ++++++--- src/pages/main/music/tracks/3-months.html | 2 +- src/pages/main/music/tracks/all-time.html | 2 +- src/pages/main/music/tracks/this-month.html | 2 +- src/pages/main/music/tracks/this-week.html | 2 +- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4544584..315b40f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "16.5.2", + "version": "16.5.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "16.5.2", + "version": "16.5.3", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.2.2", diff --git a/package.json b/package.json index b88507ca..ae959067 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "16.5.2", + "version": "16.5.3", "description": "The source for my personal site. Built using 11ty.", "type": "module", "scripts": { diff --git a/src/_data/music.js b/src/_data/music.js index d9c6f2c5..ce07fcdd 100644 --- a/src/_data/music.js +++ b/src/_data/music.js @@ -137,7 +137,8 @@ export default async function() { artists: aggregateData(periodData, 'artist_name', 'artists'), albums: aggregateData(periodData, 'album_name', 'albums'), tracks: aggregateData(periodData, 'track_name', 'track'), - genres: aggregateGenres(periodData) + genres: aggregateGenres(periodData), + totalTracks: periodData?.length?.toLocaleString('en-US') } } @@ -147,7 +148,8 @@ export default async function() { artists: aggregateData(allTimeData, 'artist_name', 'artists'), albums: aggregateData(allTimeData, 'album_name', 'albums'), tracks: aggregateData(allTimeData, 'track_name', 'track'), - genres: aggregateGenres(allTimeData) + genres: aggregateGenres(allTimeData), + totalTracks: allTimeData?.length?.toLocaleString('en-US') } const recentData = await fetchDataForPeriod(DateTime.now().minus({ days: 7 }), selectFields, 'listens') @@ -157,7 +159,8 @@ export default async function() { albums: aggregateData(recentData, 'album_name', 'albums'), tracks: aggregateData(recentData, 'track_name', 'track'), tracksChronological: aggregateData(recentData, 'track_name', 'track', false), - genres: aggregateGenres(recentData) + genres: aggregateGenres(recentData), + totalTracks: recentData?.length?.toLocaleString('en-US') } results['nowPlaying'] = results['recent']['tracksChronological'][0] diff --git a/src/pages/main/music/tracks/3-months.html b/src/pages/main/music/tracks/3-months.html index fd48be12..e6726d7f 100644 --- a/src/pages/main/music/tracks/3-months.html +++ b/src/pages/main/music/tracks/3-months.html @@ -9,6 +9,6 @@ schema: music --- {% tablericon "arrow-left" "Go back" %} Go back -

I've listened to {{ music.threeMonth.tracks.size }} tracks over the last 3 months and most of what I've listened to has been {{ music.threeMonth.genres | genresToString: 5 }}.

+

I've listened to {{ music.threeMonth.totalTracks }} tracks over the last 3 months and most of what I've listened to has been {{ music.threeMonth.genres | genresToString: 5 }}.

See my artists or albums for this period.

{% render "partials/media/music/period/chart.liquid" data:pagination, playTotal: music.threeMonth.tracks[0].plays %} \ No newline at end of file diff --git a/src/pages/main/music/tracks/all-time.html b/src/pages/main/music/tracks/all-time.html index 6ab58f94..02da90ab 100644 --- a/src/pages/main/music/tracks/all-time.html +++ b/src/pages/main/music/tracks/all-time.html @@ -9,6 +9,6 @@ schema: music --- {% tablericon "arrow-left" "Go back" %} Go back -

I've listened to {{ music.allTime.tracks.size }} tracks and most of what I've listened to has been {{ music.allTime.genres | genresToString: 5 }}.

+

I've listened to {{ music.allTime.totalTracks }} tracks and most of what I've listened to has been {{ music.allTime.genres | genresToString: 5 }}.

See my artists or albums for this period.

{% render "partials/media/music/period/chart.liquid" data:pagination, playTotal: music.allTime.tracks[0].plays %} \ No newline at end of file diff --git a/src/pages/main/music/tracks/this-month.html b/src/pages/main/music/tracks/this-month.html index e5c83020..24deac90 100644 --- a/src/pages/main/music/tracks/this-month.html +++ b/src/pages/main/music/tracks/this-month.html @@ -9,6 +9,6 @@ schema: music --- {% tablericon "arrow-left" "Go back" %} Go back -

I've listened to {{ music.month.tracks.size }} tracks this month and most of what I've listened to has been {{ music.month.genres | genresToString: 5 }}.

+

I've listened to {{ music.month.totalTracks }} tracks this month and most of what I've listened to has been {{ music.month.genres | genresToString: 5 }}.

See my artists or albums for this period.

{% render "partials/media/music/period/chart.liquid" data:pagination, playTotal: music.month.tracks[0].plays %} \ No newline at end of file diff --git a/src/pages/main/music/tracks/this-week.html b/src/pages/main/music/tracks/this-week.html index 0b2313b7..419ba5b2 100644 --- a/src/pages/main/music/tracks/this-week.html +++ b/src/pages/main/music/tracks/this-week.html @@ -9,6 +9,6 @@ schema: music --- {% tablericon "arrow-left" "Go back" %} Go back -

I've listened to {{ music.week.tracks.size }} tracks this week and most of what I've listened to has been {{ music.week.genres | genresToString: 5 }}.

+

I've listened to {{ music.week.totalTracks }} tracks this week and most of what I've listened to has been {{ music.week.genres | genresToString: 5 }}.

See my artists or albums for this period.

{% render "partials/media/music/period/chart.liquid" data:pagination, playTotal: music.week.tracks[0].plays %} \ No newline at end of file