diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-12-09 13:21:42 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-12-09 13:21:42 +0900 |
| commit | b1b5a795c864fb421c7b3508e14fded569479042 (patch) | |
| tree | 8e20907552649cb805c2a15bec60e9829b563159 /src/chart | |
| parent | #2501 (#3567) (diff) | |
| download | misskey-b1b5a795c864fb421c7b3508e14fded569479042.tar.gz misskey-b1b5a795c864fb421c7b3508e14fded569479042.tar.bz2 misskey-b1b5a795c864fb421c7b3508e14fded569479042.zip | |
Revert "Eliminate if-statement (#3556)"
This reverts commit fb8b0c291dff0bec2aca85fda34ebff9c8c49b91.
Diffstat (limited to 'src/chart')
| -rw-r--r-- | src/chart/index.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/chart/index.ts b/src/chart/index.ts index aff30bf0fa..b59ad7602b 100644 --- a/src/chart/index.ts +++ b/src/chart/index.ts @@ -61,7 +61,11 @@ export default abstract class Chart<T> { constructor(name: string, grouped = false) { this.collection = db.get<Log<T>>(`chart.${name}`); - this.collection.createIndex({ span: -1, date: -1, group: grouped ? -1 : undefined }, { unique: true }); + if (grouped) { + this.collection.createIndex({ span: -1, date: -1, group: -1 }, { unique: true }); + } else { + this.collection.createIndex({ span: -1, date: -1 }, { unique: true }); + } } @autobind |