I recently built a small personality quiz about the seven heavenly virtues: 35 statements, five per virtue, and a score out of 100 for each one at the end. The site is plain Astro with no backend, and I wanted the result to look like something from a cathedral rather than a dashboard. So instead of a radar chart library, the result is drawn as a seven-light rose window, where each pane of glass fills from the centre outward in proportion to its score.
Here are the three pieces that made it work, with the real code.
1. Scoring with reversed statements
Some statements describe the virtue ("When I'm praised, I mention the people who helped") and some describe the sin against it. Sin statements are reverse-scored, so agreeing with everything doesn't inflate the result. Each virtue has n answers of 1 to 5, which gives a range of n to 5n , mapped onto 0β100:
function score ( questions : Question [ ] , answers : number [ ] ) : number [ ] { const sums = new Map ( virtues . map ( ( v ) => [ v .β¦