From f9b5b65b1e244c6f1c9532bed21495433564af98 Mon Sep 17 00:00:00 2001 From: Ludovic Date: Fri, 4 Oct 2024 21:41:16 +0200 Subject: [PATCH] update to have proper id matching on multiple series achievement --- scripts/workflow/additional_achievement.ts | 35 ++++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/scripts/workflow/additional_achievement.ts b/scripts/workflow/additional_achievement.ts index c483959987c..fa3259bc72c 100644 --- a/scripts/workflow/additional_achievement.ts +++ b/scripts/workflow/additional_achievement.ts @@ -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;