mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-05 10:18:05 +09:00
Fix bug
This commit is contained in:
parent
7f9a6e9386
commit
176bf67b36
@ -61,10 +61,13 @@ abstract class Stats<T> {
|
||||
protected collection: ICollection<Log<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.createIndex({ span: -1, date: -1 }, { unique: true });
|
||||
this.collection.createIndex('group');
|
||||
if (grouped) {
|
||||
this.collection.createIndex({ span: -1, date: -1, group: -1 }, { unique: true });
|
||||
} else {
|
||||
this.collection.createIndex({ span: -1, date: -1 }, { unique: true });
|
||||
}
|
||||
}
|
||||
|
||||
@autobind
|
||||
@ -668,7 +671,7 @@ type HashtagLog = {
|
||||
|
||||
class HashtagStats extends Stats<HashtagLog> {
|
||||
constructor() {
|
||||
super('hashtag');
|
||||
super('hashtag', true);
|
||||
}
|
||||
|
||||
@autobind
|
||||
@ -743,7 +746,7 @@ type FollowingLog = {
|
||||
|
||||
class FollowingStats extends Stats<FollowingLog> {
|
||||
constructor() {
|
||||
super('following');
|
||||
super('following', true);
|
||||
}
|
||||
|
||||
@autobind
|
||||
|
Loading…
Reference in New Issue
Block a user