Skip to content

Commit f123b43

Browse files
committed
Fix coverage sort order
The line and branch percentages were introduced in #3348 as text columns instead of numeric columns. This PR fixes the issue by casting the value to a float, allowing the values to be sorted numerically instead of alphabetically.
1 parent b4917b0 commit f123b43

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

resources/js/vue/components/BuildCoveragePage.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@
150150
<font-awesome-icon :icon="FA.faFile" /> {{ obj.path }}
151151
</a>
152152
</template>
153-
<template #linePercentage="{ props: pct }">
153+
<template #linePercentage="{ props: { text: pct } }">
154154
<progress
155155
class="tw-progress tw-w-24"
156156
:class="percentToProgressBarColorClass(pct)"
157157
:value="pct"
158158
max="100"
159159
/> {{ pct }}%
160160
</template>
161-
<template #branchPercentage="{ props: pct }">
161+
<template #branchPercentage="{ props: { text: pct } }">
162162
<progress
163163
class="tw-progress tw-w-24"
164164
:class="percentToProgressBarColorClass(pct)"
@@ -384,11 +384,20 @@ export default {
384384
});
385385
386386
return Object.values(coverageByPrefix).map(obj => {
387+
const linePct = this.computePercentage(obj.linesOfCodeTested, obj.linesOfCodeUntested);
388+
const branchPct = this.computePercentage(obj.branchesTested, obj.branchesUntested);
389+
387390
return {
388391
...obj,
389-
linePercentage: this.computePercentage(obj.linesOfCodeTested, obj.linesOfCodeUntested),
392+
linePercentage: {
393+
text: linePct,
394+
value: parseFloat(linePct),
395+
},
390396
lines: `${obj.linesOfCodeTested} / ${obj.linesOfCodeTested + obj.linesOfCodeUntested}`,
391-
branchPercentage: this.computePercentage(obj.branchesTested, obj.branchesUntested),
397+
branchPercentage: {
398+
text: branchPct,
399+
value: parseFloat(branchPct),
400+
},
392401
branches: `${obj.branchesTested} / ${obj.branchesTested + obj.branchesUntested}`,
393402
};
394403
});

0 commit comments

Comments
 (0)