From 23335f8bd9d91398eb1adb8af7935d252d08e6b0 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 10 Feb 2021 04:20:58 +0100 Subject: [PATCH] Added last scrape date to stats page. --- assets/components/stats/stats.vue | 17 ++++++++++++++++- assets/js/ui/actions.js | 13 ++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/assets/components/stats/stats.vue b/assets/components/stats/stats.vue index 5b72c0c0..d0ff794c 100644 --- a/assets/components/stats/stats.vue +++ b/assets/components/stats/stats.vue @@ -3,7 +3,17 @@

Stats

- traxxx {{ version }} +
+
+
Version
+
{{ version }}
+
+ +
+
Content updated
+
{{ formatDate(lastScrape, 'YYYY-MM-DD HH:mm') }}
+
+
@@ -46,6 +56,7 @@ async function mounted() { this.totalActors = stats.totalActors; this.totalNetworks = stats.totalNetworks; this.totalChannels = stats.totalChannels; + this.lastScrape = stats.lastScrape; this.version = VERSION; // eslint-disable-line no-undef } @@ -75,6 +86,10 @@ export default { padding: 1rem; } +.stat-table { + margin: 0 0 1rem 0; +} + .stat-row { width: 20rem; max-width: 100%; diff --git a/assets/js/ui/actions.js b/assets/js/ui/actions.js index ee8ca345..0dba2c7c 100644 --- a/assets/js/ui/actions.js +++ b/assets/js/ui/actions.js @@ -167,7 +167,17 @@ function initUiActions(_store, _router) { channels, } = await graphql(` query Stats { - scenes: releasesConnection { totalCount } + scenes: releasesConnection( + last: 1, + orderBy: BATCH_BY_CREATED_BATCH_ID__CREATED_AT_ASC + ) { + totalCount + scenes: nodes { + batch: createdBatch { + createdAt + } + } + } movies: moviesConnection { totalCount } actors: actorsConnection { totalCount } networks: entitiesConnection(filter: { type: { equalTo: "network" } }) { totalCount } @@ -181,6 +191,7 @@ function initUiActions(_store, _router) { totalActors: actors.totalCount, totalNetworks: networks.totalCount, totalChannels: channels.totalCount, + lastScrape: new Date(scenes.scenes[0]?.batch.createdAt), }; }