Improve chart performance (#7360)
* wip * wip * wip * wip * wip * Update chart.ts * wip * Improve server performance * wip * wip
This commit is contained in:
parent
0d19c2d42e
commit
4f249159d3
32 changed files with 889 additions and 161 deletions
|
|
@ -25,6 +25,32 @@ export default class NotesChart extends Chart<NotesLog> {
|
|||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected aggregate(logs: NotesLog[]): NotesLog {
|
||||
return {
|
||||
local: {
|
||||
total: logs[0].local.total,
|
||||
inc: logs.reduce((a, b) => a + b.local.inc, 0),
|
||||
dec: logs.reduce((a, b) => a + b.local.dec, 0),
|
||||
diffs: {
|
||||
reply: logs.reduce((a, b) => a + b.local.diffs.reply, 0),
|
||||
renote: logs.reduce((a, b) => a + b.local.diffs.renote, 0),
|
||||
normal: logs.reduce((a, b) => a + b.local.diffs.normal, 0),
|
||||
},
|
||||
},
|
||||
remote: {
|
||||
total: logs[0].remote.total,
|
||||
inc: logs.reduce((a, b) => a + b.remote.inc, 0),
|
||||
dec: logs.reduce((a, b) => a + b.remote.dec, 0),
|
||||
diffs: {
|
||||
reply: logs.reduce((a, b) => a + b.remote.diffs.reply, 0),
|
||||
renote: logs.reduce((a, b) => a + b.remote.diffs.renote, 0),
|
||||
normal: logs.reduce((a, b) => a + b.remote.diffs.normal, 0),
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async fetchActual(): Promise<DeepPartial<NotesLog>> {
|
||||
const [localCount, remoteCount] = await Promise.all([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue