From ed22cabba74bbdb341d7791de64d6fa546d5168b Mon Sep 17 00:00:00 2001 From: James Berke <58538332+jamesberke@users.noreply.github.com> Date: Fri, 21 May 2021 09:04:57 -0700 Subject: [PATCH] filtered unintended commas out of cardList (#1601) --- pages/wins/wins.html | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pages/wins/wins.html b/pages/wins/wins.html index d232413982..6330158695 100644 --- a/pages/wins/wins.html +++ b/pages/wins/wins.html @@ -269,8 +269,23 @@ } } + function insertIcons(cloneCardTemplate, cardClass, cardString) { - let cardList = cardString.split(',').map(item => item.trim()) + let initialCardList = cardString.split(',').map(item => item.trim()) + let otherWinsText = []; + let cardList = []; + + initialCardList.forEach(win => { + if (badgeIcons.hasOwnProperty(win)){ + cardList.push(win); + } else if (win === " "){ + return + } else { + otherWinsText.push(win); + } + }); + cardList.push(otherWinsText.join(", ")); + const SVG_FILE_PATH = `/assets/images/wins-page/wins-badges/` cardList.map(function (item) { @@ -479,6 +494,7 @@ const item = string.trim() const SVG_FILE_PATH = `/assets/images/wins-page/wins-badges/` + if (badgeIcons.hasOwnProperty(item)) { cloneCardTemplate.insertAdjacentHTML('beforeend', `
@@ -498,6 +514,7 @@ ) return } + }) }