Skip to content

Commit

Permalink
fix(#1058): sort by % data in rules list (#1062)
Browse files Browse the repository at this point in the history
This PR fixes percentage sorting in table

(cherry picked from commit 736c109)
  • Loading branch information
leiyre authored and frascuchon committed Jan 31, 2022
1 parent 6c1ae7f commit 9735f22
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/components/core/ReTableInfo.vue
Expand Up @@ -102,6 +102,14 @@
<span v-else-if="column.type === 'number'">
{{ itemValue(item, column) | formatNumber }}
</span>
<span
v-else-if="
!isNaN(itemValue(item, column)) &&
column.type === 'percentage'
"
>
{{ itemValue(item, column) | percent }}
</span>
<span v-else-if="column.type === 'object'">
<p
v-for="key in Object.keys(itemValue(item, column))"
Expand Down
Expand Up @@ -91,12 +91,14 @@ export default {
name: "Coverage",
field: "coverage",
class: "text",
type: "percentage",
tooltip: "Percentage of records labeled by the rule",
},
{
name: "Annot. Cover.",
field: "coverage_annotated",
class: "text",
type: "percentage",
tooltip: "Percentage of annotated records labeled by the rule",
},
{
Expand All @@ -117,6 +119,7 @@ export default {
name: "Precision",
field: "precision",
class: "text",
type: "percentage",
tooltip: "Percentage of correct labels given by the rule",
},
{
Expand Down Expand Up @@ -190,6 +193,21 @@ export default {
getRuleMetricsByLabel:
"entities/text_classification/getRuleMetricsByLabel",
}),
metricsForRule(rule) {
const metrics = this.perRuleMetrics[rule.query];
if (!metrics) {
return {};
}
return {
coverage: metrics.coverage,
coverage_annotated: metrics.coverage_annotated,
correct: metrics.correct,
incorrect: metrics.incorrect,
precision: !isNaN(metrics.precision) ? metrics.precision : "-",
};
},
async hideList() {
await this.dataset.viewSettings.disableRulesSummary();
},
Expand Down

0 comments on commit 9735f22

Please sign in to comment.