Skip to content

Commit

Permalink
possible fix for 9844
Browse files Browse the repository at this point in the history
  • Loading branch information
paglias committed Jan 21, 2018
1 parent de93b47 commit 2e92746
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions website/server/controllers/api-v3/challenges.js
Expand Up @@ -559,15 +559,14 @@ api.exportChallengeCsv = {
.lean().exec(),
]);

let resArray = members.map(member => [member._id, member.profile.name]);
const resArray = members.map(member => [member._id, member.profile.name]);

// We assume every user in the challenge as at least some data so we can say that members[0] tasks will be at tasks [0]
let lastUserId;
let index = -1;
tasks.forEach(task => {
if (task.userId !== lastUserId) {
lastUserId = task.userId;
while (task.userId !== lastUserId) {
index++;
lastUserId = resArray[index][0]; // resArray[index][0] is an user id
}

const streak = task.streak || 0;
Expand Down

0 comments on commit 2e92746

Please sign in to comment.