Skip to content

Commit

Permalink
update to have proper id matching on multiple series achievement
Browse files Browse the repository at this point in the history
  • Loading branch information
LudovicMalot committed Oct 4, 2024
1 parent 25ee48e commit f9b5b65
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions scripts/workflow/additional_achievement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,28 +162,31 @@ const main = async () => {
console.warn(`Warning: No data found for category: ${category.text}`);
continue;
}
const achievementData: { id: number; name: string }[] = currentData.achievements.map(
(achievement: {
id: number;
name: string;
desc: string;
reward: number;
hidden: boolean;
order: number;
}) => {
return {
id: achievement.id,
name: achievement.name
};
}
);
const achievementData: { id: number; name: string; reward: number }[] =
currentData.achievements.map(
(achievement: {
id: number;
name: string;
desc: string;
reward: number;
hidden: boolean;
order: number;
}) => {
return {
id: achievement.id,
name: achievement.name,
reward: achievement.reward
};
}
);

const categoryData = await parseCategoryPage(fullUrl, category.text);
categoryData.forEach((data) => {
const found = achievementData.find(
(a) =>
a.name.toLowerCase().replace(/[^a-z0-9]/g, '') ===
data.achievement.toLowerCase().replace(/[^a-z0-9]/g, '')
data.achievement.toLowerCase().replace(/[^a-z0-9]/g, '') &&
a.reward === parseInt(data.primo)
);
if (found) {
data.id = found.id;
Expand Down

0 comments on commit f9b5b65

Please sign in to comment.