more stats

This commit is contained in:
qwertyforce 2020-09-16 16:18:20 +03:00
parent cf88c2d5e8
commit 0f8f826b14

View File

@ -10,7 +10,9 @@ export default function Index(props: any) {
<AppBar />
<div>Total Images: {props.number_of_images}</div>
<div>Total Authors: {props.number_of_authors}</div>
<div>Total tags: {props.number_of_tags}</div>
<div>Total Tags: {props.number_of_tags}</div>
<div>Images deleted: {props.number_of_deleted}</div>
<div>ID of the last image: {props.last_image_id}</div>
</div>
);
}
@ -19,6 +21,7 @@ export const getStaticProps: GetStaticProps = async () => {
const imgs = await db_ops.image_ops.get_all_images()
const authors = new Set()
const tags = new Set()
const id_of_last_image=imgs[imgs.length-1].id
for (const img of imgs) {
authors.add(img.author)
for (const tag of img.tags) {
@ -30,6 +33,8 @@ export const getStaticProps: GetStaticProps = async () => {
number_of_images: imgs.length,
number_of_authors: authors.size,
number_of_tags: tags.size,
number_of_deleted:id_of_last_image-imgs.length,
last_image_id:id_of_last_image
},
revalidate:5*60 //5 min
}