Skip to content

Commit

Permalink
feat: Clarify the average score of compile release-level checks, close
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Aug 13, 2023
1 parent 81ebb51 commit 5b976af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
23 changes: 13 additions & 10 deletions frontend/src/components/ResourceLevelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@
class="td col-8 col-lg-7 text-right text-lg-left info_message"
scope="col"
>
{{ resourceLevelStats.length }} {{ $t("resourceLevel.averageScore.description") }}:
<span v-if="avgScore != null">
{{ avgScore | formatPercentage }}
</span>
<span v-else>
{{ $t("resourceLevel.averageScore.undefined") }}
</span>
{{ $t("resourceLevel.averageScore.description", { applicable: applicableChecks, total: resourceLevelStats.length, average_score: formattedAvgScore }) }}
<Tooltip :text="$t('resourceLevel.averageScore.tooltip')" />
</div>
</div>
Expand Down Expand Up @@ -129,7 +123,16 @@ export default {
})
.filter(this.filter);
},
avgScore() {
applicableChecks() {
var applicableCount = 0;
for (var i = 0; i < this.resourceLevelStats.length; i++) {
if (this.resourceLevelStats[i].undefined_count < this.resourceLevelStats[i].total_count) {
applicableCount += 1;
}
}
return applicableCount;
},
formattedAvgScore() {
var passedCount = 0;
var failedCount = 0;
for (var i = 0; i < this.resourceLevelStats.length; i++) {
Expand All @@ -138,10 +141,10 @@ export default {
}
if (passedCount + failedCount == 0) {
return null;
return this.$t("resourceLevel.averageScore.undefined");
}
return (100.0 * passedCount) / (passedCount + failedCount);
return this.$options.filters.formatPercentage(100.0 * passedCount / (passedCount + failedCount));
}
},
watch: {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/messages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ export const messages = {
application_count_header_tooltip:
"One 'check' can be made up of many 'tests'; for example, when checking whether start dates aren't after end dates, each pair of start dates and end dates is <i>tested</i>. This shows the proportion of tests that passed or failed, instead of the proportion of compiled releases that passed or failed.",
averageScore: {
description: "checks in total with average score",
description:
"{applicable} of {total} checks are applicable, with a pass rate of {average_score}, excluding n/a",
undefined: "undefined",
tooltip: "The pass rate is calculated as: all passed / (all passed + all failed)."
},
Expand Down

0 comments on commit 5b976af

Please sign in to comment.