Skip to content

Commit

Permalink
Refactor the 2nd
Browse files Browse the repository at this point in the history
  • Loading branch information
robflop committed Sep 12, 2018
1 parent 1bb1168 commit 17a33b0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,23 @@ server.get('/api/statistics', (req, res) => { // eslint-disable-line complexity
// Count filtering
if (equals || over || under) {
if (equals) {
requestedStats = filterStats(statistics, firstStatDate, latestStatDate, (iterator, startDate, endDate) => {
return statistics[iterator] === equals;
requestedStats = filterStats(requestedStats, firstStatDate, latestStatDate, (iterator, startDate, endDate) => {
return requestedStats[iterator] === equals;
});
}
else if (over && !under) {
requestedStats = filterStats(statistics, firstStatDate, latestStatDate, (iterator, startDate, endDate) => {
return statistics[iterator] > over;
requestedStats = filterStats(requestedStats, firstStatDate, latestStatDate, (iterator, startDate, endDate) => {
return requestedStats[iterator] > over;
});
}
else if (!over && under) {
requestedStats = filterStats(statistics, firstStatDate, latestStatDate, (iterator, startDate, endDate) => {
return statistics[iterator] < under;
requestedStats = filterStats(requestedStats, firstStatDate, latestStatDate, (iterator, startDate, endDate) => {
return requestedStats[iterator] < under;
});
}
else if (over && under) {
requestedStats = filterStats(statistics, firstStatDate, latestStatDate, (iterator, startDate, endDate) => {
return statistics[iterator] > over && statistics[iterator] < under;
requestedStats = filterStats(requestedStats, firstStatDate, latestStatDate, (iterator, startDate, endDate) => {
return requestedStats[iterator] > over && requestedStats[iterator] < under;
});
}

Expand Down

0 comments on commit 17a33b0

Please sign in to comment.