fix(user): new function to compute unique days within hours.

This commit is contained in:
kennethlumalicay
2017-11-03 06:17:13 -04:00
parent a92ff79b5e
commit 46383ddaa6
3 changed files with 92 additions and 52 deletions

View File

@@ -17,7 +17,7 @@ import {
} from '../utils/middleware';
import { observeQuery } from '../utils/rx';
import {
prepUniqueDays,
prepUniqueDaysByHours,
calcCurrentStreak,
calcLongestStreak
} from '../utils/user-stats';
@@ -492,7 +492,7 @@ module.exports = function(app) {
// not of the profile she is viewing
const timezone = user && user.timezone ?
user.timezone :
'UTC';
'EST';
const query = {
where: { username },
@@ -517,10 +517,10 @@ module.exports = function(app) {
objOrNum.timestamp;
});
const uniqueDays = prepUniqueDays(timestamps, timezone);
const uniqueHours = prepUniqueDaysByHours(timestamps, timezone);
userPortfolio.currentStreak = calcCurrentStreak(uniqueDays, timezone);
userPortfolio.longestStreak = calcLongestStreak(uniqueDays, timezone);
userPortfolio.currentStreak = calcCurrentStreak(uniqueHours, timezone);
userPortfolio.longestStreak = calcLongestStreak(uniqueHours, timezone);
const calender = userPortfolio
.progressTimestamps