summaryrefslogtreecommitdiff
path: root/backend/reduce.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2018-05-10 13:40:40 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2018-12-13 16:59:18 +0100
commit0b16c89884f8c586b5edffa612af02144e3006a2 (patch)
tree78e86f3b28f8401290e61f734bf6ae4782f9ec18 /backend/reduce.js
parent62abcb8f563edcd639b5dc36b6467debbfbd3215 (diff)
downloadbrokentalents-0b16c89884f8c586b5edffa612af02144e3006a2.tar.gz
brokentalents-0b16c89884f8c586b5edffa612af02144e3006a2.zip
merge 'NoTalent' and null talents
Diffstat (limited to 'backend/reduce.js')
-rw-r--r--backend/reduce.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/backend/reduce.js b/backend/reduce.js
index 3ac9da2..519004c 100644
--- a/backend/reduce.js
+++ b/backend/reduce.js
@@ -3,6 +3,13 @@
const R = require('ramda'),
utils = require('./utils');
+function cleanPayloads(config) {
+ return R.map(R.pipe(
+ // some Talents are 'null', some are 'NoTalent'
+ R.over(R.lensProp('Talent'), R.defaultTo('NoTalent')),
+ ));
+}
+
function aggregatePayloads(config) {
// Ramda group() only groups neighbors, so sort beforehand
const sorter = R.props(config.group);
@@ -46,6 +53,7 @@ function deriveStatistics(config) {
}
module.exports = {
+ cleanPayloads,
aggregatePayloads,
deriveStatistics,
};