add daily size download

This commit is contained in:
Simon 2023-11-09 10:22:43 +07:00
parent 9c26357f76
commit 04124e3dad
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 6 additions and 2 deletions

View File

@ -170,7 +170,8 @@ class DownloadHist(AggBase):
"order": {"_key": "desc"}, "order": {"_key": "desc"},
}, },
"aggs": { "aggs": {
"total_videos": {"value_count": {"field": "youtube_id"}} "total_videos": {"value_count": {"field": "youtube_id"}},
"media_size": {"sum": {"field": "media_size"}},
}, },
} }
}, },
@ -186,6 +187,7 @@ class DownloadHist(AggBase):
{ {
"date": i.get("key_as_string"), "date": i.get("key_as_string"),
"count": i.get("doc_count"), "count": i.get("doc_count"),
"media_size": i["media_size"].get("value"),
} }
for i in buckets for i in buckets
] ]

View File

@ -241,7 +241,9 @@ function buildDailyStat(dailyStat) {
text = 'Video'; text = 'Video';
} }
message.innerText = `+${dailyStat.count} ${text}`; message.innerText =
`+${dailyStat.count} ${text}
${humanFileSize(dailyStat.media_size)}`;
tile.appendChild(message); tile.appendChild(message);
return tile; return tile;