summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-10-21 14:47:44 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-10-21 14:47:44 +0900
commitc57f472caf2c3658d75803aa9c48eef0040ef236 (patch)
treeb3ca70103bad8ab95f5bf48f8e690dfbe111f7ed /src
parentImprove readability (diff)
downloadsharkey-c57f472caf2c3658d75803aa9c48eef0040ef236.tar.gz
sharkey-c57f472caf2c3658d75803aa9c48eef0040ef236.tar.bz2
sharkey-c57f472caf2c3658d75803aa9c48eef0040ef236.zip
Improve readability
Diffstat (limited to 'src')
-rw-r--r--src/services/stats.ts24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/services/stats.ts b/src/services/stats.ts
index d5c6916a55..11d5b3dd77 100644
--- a/src/services/stats.ts
+++ b/src/services/stats.ts
@@ -159,8 +159,14 @@ abstract class Chart<T> {
protected commit(query: Obj, group?: Obj, uniqueKey?: string, uniqueValue?: string): void {
const update = (stats: ChartDocument<T>) => {
// ユニークインクリメントの場合、指定のキーに指定の値が既に存在していたら弾く
- if (uniqueKey && stats.unique && stats.unique[uniqueKey] && stats.unique[uniqueKey].includes(uniqueValue)) return;
+ if (
+ uniqueKey &&
+ stats.unique &&
+ stats.unique[uniqueKey] &&
+ stats.unique[uniqueKey].includes(uniqueValue)
+ ) return;
+ // ユニークインクリメントの指定のキーに値を追加
if (uniqueKey) {
query['$push'] = {
[`unique.${uniqueKey}`]: uniqueValue
@@ -241,21 +247,21 @@ abstract class Chart<T> {
/**
* [{
- * x: 1,
- * y: 5
+ * xxxxx: 1,
+ * yyyyy: 5
* }, {
- * x: 2,
- * y: 6
+ * xxxxx: 2,
+ * yyyyy: 6
* }, {
- * x: 3,
- * y: 7
+ * xxxxx: 3,
+ * yyyyy: 7
* }]
*
* を
*
* {
- * x: [1, 2, 3],
- * y: [5, 6, 7]
+ * xxxxx: [1, 2, 3],
+ * yyyyy: [5, 6, 7]
* }
*
* にする