From 16ae4f62f4ee7b807279e4b89d364452d6a90a52 Mon Sep 17 00:00:00 2001 From: Ilya Shatokhin Date: Mon, 18 Sep 2017 20:06:01 +0300 Subject: [PATCH] Try to fix #7 again --- modules/statsapi.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/modules/statsapi.js b/modules/statsapi.js index b5a46c7..11d3554 100644 --- a/modules/statsapi.js +++ b/modules/statsapi.js @@ -522,10 +522,7 @@ getActionErrorInfo:function (t, p, cb) { $facet: { _id: [{ $group: { - _id: { - $cond: {if: ALL, then: "$_idp", else: "$ehash" - } - }, + _id: ALL ? "$_idp" : "$ehash", c: {$sum: 1} } }, { @@ -570,7 +567,7 @@ getActionErrorInfo:function (t, p, cb) { var tmpReporter = tmpData[0].reporter; var tmpServer = tmpData[0].server; var tmpLang = tmpData[0].lang; - var res = {route: [],server: [],reporter: [],lang: [],count: _.get(tmp_id, "c", 0)}; + var res = {route: [],server: [],reporter: [],lang: [],count:tmp_id.c}; _.each(tmpRoute, function(v, k) { if (v._id != null) { res.route.push({k: v._id, v: v.c}); @@ -847,13 +844,7 @@ getPageErrorInfo:function (t, p, cb) { $facet: { _id: [{ $group: { - _id: { - $cond: { - if: ALL, - then: "$_idp", - else: "$ehash" - } - }, + _id: ALL ? "$_idp" : "$ehash", c: {$sum: 1} } }, {