Trends: also track total tag usages

This commit is contained in:
Alex Gleason
2023-07-25 17:19:31 -05:00
parent 1d67181e52
commit e8df411834
2 changed files with 5 additions and 4 deletions

View File

@@ -4,17 +4,17 @@ import { trends } from '@/trends.ts';
import { Time } from '@/utils.ts';
const trendingTagsController: AppController = (c) => {
const yesterday = new Date(new Date().getTime() - Time.days(1));
const now = new Date();
const yesterday = new Date(now.getTime() - Time.days(1));
const tags = trends.getTrendingTags(yesterday, now);
return c.json(tags.map(({ name, accounts }) => ({
return c.json(tags.map(({ name, accounts, uses }) => ({
name,
url: Conf.local(`/tags/${name}`),
history: [{
day: String(Math.floor(yesterday.getTime() / 1000)),
uses: String(accounts), // Not actually true - we don't collect this
uses: String(uses),
accounts: String(accounts),
}],
})));