|
13 | 13 | </p> |
14 | 14 |
|
15 | 15 | <!-- Ranking questions: Borda count with average rank --> |
16 | | - <div |
17 | | - v-if="question.type === 'ranking'" |
18 | | - class="question-summary__statistic"> |
| 16 | + <div v-if="question.type === 'ranking'" class="question-summary__statistic"> |
19 | 17 | <p class="question-summary__ranking-description"> |
20 | | - {{ t('forms', 'Ranked by Borda count: each 1st place receives {n} points, 2nd place {n1} points, and so on. Higher score means more preferred.', { n: question.options.length, n1: question.options.length - 1 }) }} |
| 18 | + {{ |
| 19 | + t( |
| 20 | + 'forms', |
| 21 | + 'Ranked by Borda count: each 1st place receives {n} points, 2nd place {n1} points, and so on. Higher score means more preferred.', |
| 22 | + { |
| 23 | + n: question.options.length, |
| 24 | + n1: question.options.length - 1, |
| 25 | + }, |
| 26 | + ) |
| 27 | + }} |
21 | 28 | </p> |
22 | 29 | <ol> |
23 | | - <li v-for="option in rankingStats" :key="option.id"> |
24 | | - <label> |
25 | | - <span class="question-summary__statistic-score"> |
26 | | - {{ option.bordaTotal }} |
27 | | - </span> |
28 | | - <span class="question-summary__statistic-percentage"> |
29 | | - ({{ t('forms', 'avg. rank {average}', { average: option.avgRank }) }}): |
30 | | - </span> |
31 | | - <span |
32 | | - :class="{ |
33 | | - 'question-summary__statistic-text--best': option.best, |
34 | | - }"> |
35 | | - {{ option.text }} |
36 | | - </span> |
37 | | - </label> |
38 | | - <meter |
39 | | - min="0" |
40 | | - :max="maxBordaScore" |
41 | | - :value="option.bordaTotal" /> |
42 | | - </li> |
| 30 | + <li v-for="option in rankingStats" :key="option.id"> |
| 31 | + <label> |
| 32 | + <span class="question-summary__statistic-score"> |
| 33 | + {{ option.bordaTotal }} |
| 34 | + </span> |
| 35 | + <span class="question-summary__statistic-percentage"> |
| 36 | + ({{ |
| 37 | + t('forms', 'avg. rank {average}', { |
| 38 | + average: option.avgRank, |
| 39 | + }) |
| 40 | + }}): |
| 41 | + </span> |
| 42 | + <span |
| 43 | + :class="{ |
| 44 | + 'question-summary__statistic-text--best': |
| 45 | + option.best, |
| 46 | + }"> |
| 47 | + {{ option.text }} |
| 48 | + </span> |
| 49 | + </label> |
| 50 | + <meter min="0" :max="maxBordaScore" :value="option.bordaTotal" /> |
| 51 | + </li> |
43 | 52 | </ol> |
44 | 53 | </div> |
45 | 54 |
|
@@ -362,10 +371,7 @@ export default { |
362 | 371 | const result = Object.values(stats) |
363 | 372 | .map((s) => ({ |
364 | 373 | ...s, |
365 | | - avgRank: |
366 | | - s.count > 0 |
367 | | - ? (s.rankSum / s.count).toFixed(1) |
368 | | - : '-', |
| 374 | + avgRank: s.count > 0 ? (s.rankSum / s.count).toFixed(1) : '-', |
369 | 375 | })) |
370 | 376 | .sort((a, b) => b.bordaTotal - a.bordaTotal) |
371 | 377 |
|
|
0 commit comments