From 752bfd24ce0814b707402fd3f73f6fa1e7068498 Mon Sep 17 00:00:00 2001 From: Raymond Mutyaba Date: Fri, 25 Aug 2017 09:09:28 -0700 Subject: [PATCH 1/2] Delete tracks field when no tracks are selected to give correct output. --- src/shared/utils/challenge-listing/filter.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/utils/challenge-listing/filter.js b/src/shared/utils/challenge-listing/filter.js index 8e48d395d1..78d6239288 100644 --- a/src/shared/utils/challenge-listing/filter.js +++ b/src/shared/utils/challenge-listing/filter.js @@ -326,6 +326,10 @@ export function removeTrack(state, track) { }); } delete res.tracks[track]; + /*As was stated in the 'addTrack' function, selecting all tracks is the same as having + no tracks field. So selecting no tracks should also be the same. Removing this line + causes no challenges to be returned and flickering of the empty challenge listings.*/ + if (_.isEmpty(res.tracks)) delete res.tracks; return res; } From b64be801c146baf9d144c01bbc617c87cf995f68 Mon Sep 17 00:00:00 2001 From: Raymond Mutyaba Date: Fri, 25 Aug 2017 10:43:16 -0700 Subject: [PATCH 2/2] Added spaces to comment. Should now pass unit test. --- src/shared/utils/challenge-listing/filter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shared/utils/challenge-listing/filter.js b/src/shared/utils/challenge-listing/filter.js index 78d6239288..7a67ea6db8 100644 --- a/src/shared/utils/challenge-listing/filter.js +++ b/src/shared/utils/challenge-listing/filter.js @@ -326,9 +326,9 @@ export function removeTrack(state, track) { }); } delete res.tracks[track]; - /*As was stated in the 'addTrack' function, selecting all tracks is the same as having - no tracks field. So selecting no tracks should also be the same. Removing this line - causes no challenges to be returned and flickering of the empty challenge listings.*/ + /* As was stated in the 'addTrack' function, selecting all tracks is the same as having + * no tracks field. So selecting no tracks should also be the same. Removing this line + * causes no challenges to be returned and flickering of the empty challenge listings. */ if (_.isEmpty(res.tracks)) delete res.tracks; return res; }