Skip to content

Commit

Permalink
Update get-packet.js
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey-wu committed Nov 25, 2024
1 parent 695aed7 commit 2f9786d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions database/qbreader/get-packet.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,24 @@ function modaqifyTossup (tossup) {
const result = {
question: tossup.question.replace('<i>', '<em>').replace('</i>', '</em>'),
answer: tossup.answer.replace('<i>', '<em>').replace('</i>', '</em>'),
metadata: `${tossup.category} - ${tossup.subcategory}`
metadata: `${tossup.category} - ${tossup.subcategory}` + tossup.alternate_subcategory ? ` - ${tossup.alternate_subcategory}` : ''
};

return result;
}

/**
*
* @param {types.Bonus} bonus
* @returns
*/
function modaqifyBonus (bonus) {
const result = {
values: bonus.values ?? bonus.parts.map(() => 10),
leadin: bonus.leadin.replace('<i>', '<em>').replace('</i>', '</em>'),
parts: bonus.parts.replace('<i>', '<em>').replace('</i>', '</em>'),
parts: bonus.parts.map(part => part.replace('<i>', '<em>').replace('</i>', '</em>')),
answers: bonus.answers.map(answer => answer.replace('<i>', '<em>').replace('</i>', '</em>')),
metadata: `${bonus.category} - ${bonus.subcategory}`
metadata: `${bonus.category} - ${bonus.subcategory}` + bonus.alternate_subcategory ? ` - ${bonus.alternate_subcategory}` : ''
};

if (bonus.difficultyModifiers) {
Expand Down

0 comments on commit 2f9786d

Please sign in to comment.