Skip to content

Commit

Permalink
Merge pull request #892 from tsg-ut/settyan117/fix/character-quiz_fix…
Browse files Browse the repository at this point in the history
…_ampersand

character-quiz: & を含む項目の正解にフルネームが含まれていなかったのを修正
  • Loading branch information
settyan117 authored Apr 27, 2024
2 parents e0f8462 + f5623a3 commit 3f8c2c2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions character-quiz/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const loadCharacters = async (author: string) => {
}

const names = [...characterNames, ...characterRubys];
const namePartsList = names.map((name) => name.split(/[&\s]/));
const namePartsList = names.map((name) => name.split('&').map((nameOne) => nameOne.split(' ')));

const normalizedWorkName = workName.startsWith('"')
? workName.slice(1, -1)
Expand All @@ -100,12 +100,13 @@ const loadCharacters = async (author: string) => {
characterName: characterNames[0].replace(/ /g, ''),
workName: normalizedWorkName,
validAnswers: [
...namePartsList.map((parts) => parts.join('')),
...namePartsList.flat(),
...namePartsList.map((name) => name.flat().join('')),
...namePartsList.map((name) => name.map((nameOne) => nameOne.join(''))).flat(),
...namePartsList.flat().flat(),
],
author,
rating: rating ?? '0',
characterId: `${namePartsList[0].join('')}\0${normalizedWorkName}`,
characterId: `${namePartsList[0].flat().join('')}\0${normalizedWorkName}`,
} as CharacterData
];
})
Expand Down

0 comments on commit 3f8c2c2

Please sign in to comment.