mirror of
https://github.com/MadeBaruna/paimon-moe.git
synced 2024-12-22 14:35:38 +01:00
Update index.svelte
Added a function to ignore extraneous data included in the JSON data. The JSON data is expected to be mechanically generated, so modifying the JSON data itself was considered inappropriate.
This commit is contained in:
parent
1d1a99c392
commit
74656deb58
1 changed files with 16 additions and 2 deletions
|
@ -21,7 +21,7 @@
|
|||
|
||||
let achievementContainer;
|
||||
|
||||
let data = achievementData;
|
||||
let data = ignoreNonExistentAchievements(achievementData);
|
||||
|
||||
let achievement = data;
|
||||
let checkList = {};
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue