1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-28 14:58:24 +09:00
This commit is contained in:
syuilo 2019-04-07 23:31:58 +09:00
parent d9780606b3
commit 6a30d32e7d
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 6 additions and 6 deletions

View File

@ -4,9 +4,9 @@
<p class="empty" v-else-if="stats.length == 0"><fa icon="exclamation-circle"/>{{ $t('empty') }}</p> <p class="empty" v-else-if="stats.length == 0"><fa icon="exclamation-circle"/>{{ $t('empty') }}</p>
<!-- トランジションを有効にするとなぜかメモリリークする --> <!-- トランジションを有効にするとなぜかメモリリークする -->
<transition-group v-else tag="div" name="chart"> <transition-group v-else tag="div" name="chart">
<div v-for="stat in stats" :key="stat.name"> <div v-for="stat in stats" :key="stat.tag">
<div class="tag"> <div class="tag">
<router-link :to="`/tags/${ encodeURIComponent(stat.name) }`" :title="stat.name">#{{ stat.name }}</router-link> <router-link :to="`/tags/${ encodeURIComponent(stat.tag) }`" :title="stat.tag">#{{ stat.tag }}</router-link>
<p>{{ $t('count').replace('{}', stat.usersCount) }}</p> <p>{{ $t('count').replace('{}', stat.usersCount) }}</p>
</div> </div>
<x-chart class="chart" :src="stat.chart"/> <x-chart class="chart" :src="stat.chart"/>

View File

@ -67,7 +67,7 @@ export default define(meta, async () => {
.slice(0, max); .slice(0, max);
//#region 2(または3)で話題と判定されたタグそれぞれについて過去の投稿数グラフを取得する //#region 2(または3)で話題と判定されたタグそれぞれについて過去の投稿数グラフを取得する
const countPromises: Promise<any[]>[] = []; const countPromises: Promise<number[]>[] = [];
const range = 20; const range = 20;
@ -87,7 +87,7 @@ export default define(meta, async () => {
const countsLog = await Promise.all(countPromises); const countsLog = await Promise.all(countPromises);
const totalCounts: any = await Promise.all(hots.map(tag => Notes.createQueryBuilder('note') const totalCounts = await Promise.all(hots.map(tag => Notes.createQueryBuilder('note')
.select('count(distinct note.userId)') .select('count(distinct note.userId)')
.where(':tag = ANY(note.tags)', { tag: tag }) .where(':tag = ANY(note.tags)', { tag: tag })
.andWhere('note.createdAt > :gt', { gt: new Date(Date.now() - (interval * range)) }) .andWhere('note.createdAt > :gt', { gt: new Date(Date.now() - (interval * range)) })
@ -98,8 +98,8 @@ export default define(meta, async () => {
const stats = hots.map((tag, i) => ({ const stats = hots.map((tag, i) => ({
tag, tag,
chart: countsLog.map(counts => counts[i].length), chart: countsLog.map(counts => counts[i]),
usersCount: totalCounts[i].length usersCount: totalCounts[i]
})); }));
return stats; return stats;