Skip to content

Commit

Permalink
Fixed issues with ghost value and percentages, bug resulted because e…
Browse files Browse the repository at this point in the history
…mpty values in new matches are null, while empty values in old matches are tagged with empty quotations
  • Loading branch information
alexanderchen750 committed May 3, 2024
1 parent f1ddf5c commit a3c65fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/components/FilterList.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const FilterList = ({ pointsData, filterList, setFilterList, showPercent, showCo
const countFilteredPointsTotal = (key) => {
return pointsData.reduce((total, point) => {
// Check if the value attribute is not an empty string
if (point[key] !== '') {
if (point[key] !== '' && point[key] !== null) {
return total + 1; // Add 1 to the total if this point has a value specific to this category (key)
}
// Otherwise, just return the current total without adding anything
Expand Down Expand Up @@ -83,7 +83,7 @@ const FilterList = ({ pointsData, filterList, setFilterList, showPercent, showCo
<ul className={styles.filterValuesList} style={{ display: openKey === key ? 'block' : 'none' }}>
{/* { console.log(uniqueValues)} */}
{uniqueValues[key].map((value) => (
value !== '' && (
value !== '' && value !== null && (
<div className={styles.filterValueItem} key={value} style={{
cursor: 'pointer',
backgroundColor: isActiveFilter(key, value) ? '#8BB8E8' : ''
Expand Down

0 comments on commit a3c65fb

Please sign in to comment.