Max Red - beautified code by replacing a for for a map (: [skip ci]

This commit is contained in:
ivan 2017-01-17 15:09:00 -03:00
parent 1019b4ff96
commit 4fb1c32cbc
2 changed files with 6 additions and 7 deletions

View File

@ -93,7 +93,6 @@ class StatsChart extends React.Component {
} }
}; };
} }
} }

View File

@ -149,14 +149,14 @@ class Stats extends React.Component {
let realPeriod = result.data.length / this.getStrokes().length; let realPeriod = result.data.length / this.getStrokes().length;
for (let i = 0; i < result.data.length; i++) { result.data.map((item) => {
newStats[result.data[i].type] += result.data[i].value * 1; newStats[item.type] += item.value * 1;
newStrokes[ ID[result.data[i].type] ].values.push({ newStrokes[ ID[item.type] ].values.push({
date: result.data[i].date, date: item.date,
value: result.data[i].value * 1 value: item.value * 1
}); });
} });
this.setState({stats: newStats, strokes: newStrokes, period: realPeriod}); this.setState({stats: newStats, strokes: newStrokes, period: realPeriod});
} }