Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed to dynamically ignore incorrect achievement data. #567

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/routes/achievement/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

let achievementContainer;

let data = achievementData;
let data = ignoreNonExistentAchievements(achievementData);

let achievement = data;
let checkList = {};
Expand Down Expand Up @@ -269,7 +269,7 @@

async function changeLocale(locale) {
const data = await import(`../../data/achievement/${locale}.json`);
achievement = data.default;
achievement = ignoreNonExistentAchievements(data.default);
sortedAchievements = Object.entries(achievement).sort((a, b) => a[1].order - b[1].order);
sortedAchievements.forEach(([id, data], i) => {
categories[i].name = data.name;
Expand Down Expand Up @@ -327,6 +327,20 @@
parseCategories();
changeCategory('0', 0, true);
}

function ignoreNonExistentAchievements(origin) {
//ignore 81416,81418,81426,81429,81451,81453
const ignores = [81416, 81418, 81426, 81429, 81451, 81453];
return Object.entries(origin).reduce(
(prev,current) => {
current[1].achievements =
current[1].achievements.filter(
item => { return !ignores.includes(item.id); }
);
prev[current[0]] = current[1];
return prev;
}, {});
}

onMount(async () => {
process();
Expand Down