Max Red - beautified code by replacing a for for a map (: [skip ci]
This commit is contained in:
parent
1019b4ff96
commit
4fb1c32cbc
|
@ -93,7 +93,6 @@ class StatsChart extends React.Component {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue