diff --git a/app/utils/normalise-data.js b/app/utils/normalise-data.js index 2de8b9b..0b3e9dd 100644 --- a/app/utils/normalise-data.js +++ b/app/utils/normalise-data.js @@ -29,7 +29,7 @@ export default function normaliseData(data, highestDate) { let lastValue; normalisedKeys.forEach(key => { if(data[key]) { - lastValue = data[key].length + lastValue = Array.isArray(data[key]) ? data[key].length : data[key] } output[key] = lastValue; }) diff --git a/cli.js b/cli.js index 47ca6d2..7142924 100755 --- a/cli.js +++ b/cli.js @@ -37,6 +37,17 @@ async function list(lttfPlugins, previousResultsPath) { } } + // Squash old entries + for (let date in previousResults) { + for (let plugin in previousResults[date]) { + for (let rule in previousResults[date][plugin]) { + if (Array.isArray(previousResults[date][plugin][rule])) { + previousResults[date][plugin][rule] = previousResults[date][plugin][rule].length; + } + } + } + } + let today = new Date(); let isoDate = today.toISOString().split('T')[0];