add First Letter column with special epistle handling

This commit is contained in:
George Powell
2026-01-26 23:31:24 -05:00
parent 77d6254a2c
commit 8c488d27df
2 changed files with 68 additions and 8 deletions

View File

@@ -17,6 +17,7 @@
testamentMatch: boolean;
sectionMatch: boolean;
adjacent: boolean;
firstLetterMatch: boolean;
}
let { data }: PageProps = $props();
@@ -87,6 +88,15 @@
const testamentMatch = book.testament === correctBook.testament;
const sectionMatch = book.section === correctBook.section;
const adjacent = isAdjacent(bookId, correctBookId);
// Special case: if correct book is Epistles + starts with "1",
// any guess starting with "1" counts as first letter match
const correctIsEpistlesWithNumber = correctBook.section === "Epistles" && correctBook.name[0] === "1";
const guessStartsWithNumber = book.name[0] === "1";
const firstLetterMatch = correctIsEpistlesWithNumber && guessStartsWithNumber
? true
: book.name[0].toUpperCase() === correctBook.name[0].toUpperCase();
console.log(
`Guess: ${book.name} (order ${book.order}), Correct: ${correctBook.name} (order ${correctBook.order}), Adjacent: ${adjacent}`
@@ -110,6 +120,7 @@
testamentMatch,
sectionMatch,
adjacent,
firstLetterMatch,
},
...guesses,
];
@@ -181,11 +192,21 @@
const testamentMatch = book.testament === correctBook.testament;
const sectionMatch = book.section === correctBook.section;
const adjacent = isAdjacent(bookId, correctBookId);
// Apply same first letter logic as in submitGuess
const correctIsEpistlesWithNumber = correctBook.section === "Epistles" && correctBook.name[0] === "1";
const guessStartsWithNumber = book.name[0] === "1";
const firstLetterMatch = correctIsEpistlesWithNumber && guessStartsWithNumber
? true
: book.name[0].toUpperCase() === correctBook.name[0].toUpperCase();
return {
book,
testamentMatch,
sectionMatch,
adjacent,
firstLetterMatch,
};
});
}