mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-04 05:24:59 +01:00
Fix bug
This commit is contained in:
parent
0dc94547f5
commit
59266b3190
1 changed files with 8 additions and 5 deletions
|
@ -61,10 +61,13 @@ abstract class Stats<T> {
|
||||||
protected collection: ICollection<Log<T>>;
|
protected collection: ICollection<Log<T>>;
|
||||||
protected abstract async getTemplate(init: boolean, latest?: T, group?: any): Promise<T>;
|
protected abstract async getTemplate(init: boolean, latest?: T, group?: any): Promise<T>;
|
||||||
|
|
||||||
constructor(name: string) {
|
constructor(name: string, grouped = false) {
|
||||||
this.collection = db.get<Log<T>>(`stats.${name}`);
|
this.collection = db.get<Log<T>>(`stats.${name}`);
|
||||||
this.collection.createIndex({ span: -1, date: -1 }, { unique: true });
|
if (grouped) {
|
||||||
this.collection.createIndex('group');
|
this.collection.createIndex({ span: -1, date: -1, group: -1 }, { unique: true });
|
||||||
|
} else {
|
||||||
|
this.collection.createIndex({ span: -1, date: -1 }, { unique: true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
|
@ -668,7 +671,7 @@ type HashtagLog = {
|
||||||
|
|
||||||
class HashtagStats extends Stats<HashtagLog> {
|
class HashtagStats extends Stats<HashtagLog> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('hashtag');
|
super('hashtag', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
|
@ -743,7 +746,7 @@ type FollowingLog = {
|
||||||
|
|
||||||
class FollowingStats extends Stats<FollowingLog> {
|
class FollowingStats extends Stats<FollowingLog> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('following');
|
super('following', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
|
|
Loading…
Reference in a new issue