Skip to content

Commit 408ebc9

Browse files
authored
Merge pull request topcoder-platform#65 from suppermancool/code-30090056
Code 30090056
2 parents f8f8bd8 + c5828cc commit 408ebc9

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

__tests__/__snapshots__/index.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,17 @@ Object {
426426
"countReset": [Function],
427427
"debug": [Function],
428428
"dir": [Function],
429+
"dirxml": [Function],
429430
"error": [Function],
430431
"group": [Function],
431432
"groupCollapsed": [Function],
432433
"groupEnd": [Function],
433434
"info": [Function],
434435
"log": [Function],
436+
"table": [Function],
435437
"time": [Function],
436438
"timeEnd": [Function],
439+
"timeLog": [Function],
437440
"trace": [Function],
438441
"warn": [Function],
439442
},

src/actions/challenge-listing.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,26 +197,27 @@ function getActiveChallengesDone(
197197
}).catch(() => ({ challenges: [] })));
198198
}
199199
return Promise.all(calls).then(([ch, uch]) => {
200+
let fullCH = ch;
200201
/* uch array contains challenges where the user is participating in
201202
* some role. The same challenge are already listed in res array, but they
202203
* are not attributed to the user there. This block of code marks user
203204
* challenges in an efficient way. */
204205
if (uch) {
205206
const map = {};
206-
uch.challenges.forEach((item) => { map[item.id] = item; });
207-
ch.challenges.forEach((item) => {
208-
if (map[item.id]) {
209-
/* It is fine to reassing, as the array we modifying is created just
210-
* above within the same function. */
211-
/* eslint-disable no-param-reassign */
212-
item.users[user] = true;
213-
item.userDetails = map[item.id].userDetails;
214-
/* eslint-enable no-param-reassign */
215-
}
207+
uch.challenges.forEach((item) => {
208+
map[item.id] = item;
209+
/* eslint-disable no-param-reassign */
210+
item.users[user] = true;
211+
item.userDetails = map[item.id].userDetails;
212+
/* eslint-enable no-param-reassign */
216213
});
217214
}
218215

219-
let { challenges, meta } = ch;
216+
if (uch) {
217+
fullCH = uch;
218+
}
219+
let { challenges } = fullCH;
220+
let { meta } = ch;
220221
// filter by date range and re-compute meta
221222
// we can safely remove the next two lines when backend support date range
222223
challenges = filterUtil.filterByDate(challenges, frontFilter);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy