Skip to content

Commit

Permalink
Update name matching to use lowercase values.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxswa committed Aug 12, 2023
1 parent f1e2155 commit 7935c5a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hiscores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function parseJsonStats(json: HiscoresResponse): Stats {
const getActivity = (formattedName: string): Activity => {
const hiscoresActivity = json.activities.find(
// We must match on name here since id is not guaranteed to be the same between updates
({ name }) => name === formattedName
({ name }) => name.toLowerCase() === formattedName.toLowerCase()
);
return {
rank: hiscoresActivity?.rank ?? -1,
Expand All @@ -133,7 +133,8 @@ export function parseJsonStats(json: HiscoresResponse): Stats {
const skills = SKILLS.reduce<Skills>((skillsObject, skillName) => {
const hiscoresSkill = json.skills.find(
// We must match on name here since id is not guaranteed to be the same between updates
({ name }) => name === FORMATTED_SKILL_NAMES[skillName]
({ name }) =>
name.toLowerCase() === FORMATTED_SKILL_NAMES[skillName].toLowerCase()
);
return {
...skillsObject,
Expand Down

0 comments on commit 7935c5a

Please sign in to comment.