Fix duplicate hidden entries in analytics (#3576)

This commit is contained in:
Prospector 2025-04-29 08:12:38 -07:00 committed by GitHub
parent 5e7444f115
commit 3d9be0cc3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 9 deletions

View File

@ -86,8 +86,8 @@
<UpdatedIcon /> <UpdatedIcon />
</Button> </Button>
<DropdownSelect <DropdownSelect
class="range-dropdown"
v-model="selectedRange" v-model="selectedRange"
class="range-dropdown"
:options="ranges" :options="ranges"
name="Time range" name="Time range"
:display-name=" :display-name="
@ -197,11 +197,11 @@
> >
<div class="country-flag-container"> <div class="country-flag-container">
<template v-if="name.toLowerCase() === 'xx' || !name"> <template v-if="name.toLowerCase() === 'xx' || !name">
<img <div
src="https://cdn.modrinth.com/placeholder-banner.svg" class="country-flag flex select-none items-center justify-center bg-bg-raised font-extrabold text-secondary"
alt="Placeholder flag" >
class="country-flag" ?
/> </div>
</template> </template>
<template v-else> <template v-else>
<img <img
@ -213,7 +213,7 @@
</div> </div>
<div class="country-text"> <div class="country-text">
<strong class="country-name" <strong class="country-name"
><template v-if="name.toLowerCase() === 'xx' || !name">Hidden</template> ><template v-if="name.toLowerCase() === 'xx' || !name">Other</template>
<template v-else>{{ countryCodeToName(name) }}</template> <template v-else>{{ countryCodeToName(name) }}</template>
</strong> </strong>
<span class="data-point">{{ formatNumber(count) }}</span> <span class="data-point">{{ formatNumber(count) }}</span>

View File

@ -262,8 +262,9 @@ export const processAnalyticsByCountry = (category, projects, sortFn) => {
loadedProjectData.forEach((data) => { loadedProjectData.forEach((data) => {
Object.entries(data).forEach(([country, value]) => { Object.entries(data).forEach(([country, value]) => {
const current = countrySums.get(country) || 0; const countryCode = country || "XX";
countrySums.set(country, current + value); const current = countrySums.get(countryCode) || 0;
countrySums.set(countryCode, current + value);
}); });
}); });