Added last scrape date to stats page.

This commit is contained in:
DebaucheryLibrarian 2021-02-10 04:20:58 +01:00
parent b6022a3e90
commit 23335f8bd9
2 changed files with 28 additions and 2 deletions

View File

@ -3,7 +3,17 @@
<div class="content-inner">
<h1 class="heading">Stats</h1>
<span class="version">traxxx {{ version }}</span>
<dl class="stat-table">
<div class="stat-row">
<dt class="stat-label">Version</dt>
<dd class="stat-value">{{ version }}</dd>
</div>
<div class="stat-row">
<dt class="stat-label">Content updated</dt>
<dd class="stat-value">{{ formatDate(lastScrape, 'YYYY-MM-DD HH:mm') }}</dd>
</div>
</dl>
<dl class="stat-table">
<div class="stat-row">
@ -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%;

View File

@ -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),
};
}