From 25f6d18009192ce171655c23f005b471ce37d0f5 Mon Sep 17 00:00:00 2001 From: Cody Stoltman Date: Fri, 28 Oct 2016 17:21:04 -0500 Subject: [PATCH] setup avg, count, and sum in parse result --- machines/parse-native-query-result.js | 29 ++++++++------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/machines/parse-native-query-result.js b/machines/parse-native-query-result.js index b583f61..1c57aa6 100644 --- a/machines/parse-native-query-result.js +++ b/machines/parse-native-query-result.js @@ -106,32 +106,19 @@ module.exports = { }; break; - case 'average': + case 'avg': var avg = _.first(inputs.nativeQueryResult.rows).avg; - normalizedResult = { - avg: Number(avg) - }; - break; - - case 'max': - var max = _.first(inputs.nativeQueryResult.rows).max; - normalizedResult = { - max: Number(max) - }; - break; - - case 'min': - var min = _.first(inputs.nativeQueryResult.rows).min; - normalizedResult = { - min: Number(min) - }; + normalizedResult = Number(avg); break; case 'sum': var sum = _.first(inputs.nativeQueryResult.rows).sum; - normalizedResult = { - sum: Number(sum) - }; + normalizedResult = Number(sum); + break; + + case 'count': + var count = _.first(inputs.nativeQueryResult.rows).count; + normalizedResult = Number(count); break; default: