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

View File

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