Skip to content

Commit ea39853

Browse files
openeuler-ci-botgitee-org
authored andcommitted
!90 优化评测图表数据处理
From: @lnlnln629 Reviewed-by: @hongyu-shi Signed-off-by: @hongyu-shi
2 parents 0a7719f + 73aa49b commit ea39853

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/views/evaluate/testCase.vue

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,11 @@ const initChart = async () => {
285285
}
286286
]
287287
});
288+
const { avePre, aveRec, aveFai, aveRel, aveLcs, aveLeve, aveJac } = testCaseAvg.value;
288289
chartInstanceL.setOption({
289290
color: ['rgb(141,152,170)'],
290291
textStyle: {
291-
color: 'rgb(141,152,170)'
292+
color: 'rgb(141,152,170)'
292293
},
293294
lineStyle: {
294295
color: 'rgb(141,152,170)'
@@ -359,7 +360,7 @@ const initChart = async () => {
359360
series: [
360361
{
361362
type: 'bar',
362-
data: Object.values(testCaseAvg.value),
363+
data: [avePre, aveRec, aveFai, aveRel, aveLcs, aveLeve, aveJac],
363364
barWidth: 8,
364365
itemStyle: {
365366
color: 'rgb(0,98,220)',
@@ -458,18 +459,20 @@ const queryTestCase = ()=>{
458459
testingId: props.rowData?.testingId
459460
}
460461
EvaluateAPI.testingCase(params).then((res:any) => {
462+
const safe = (v: number) => v < 0 ? 0 : v;
463+
const { aveScore, avePre, aveRec, aveFai, aveRel, aveLcs, aveLeve, aveJac, testCases, total } = res;
461464
testCaseAvg.value = {
462-
aveScore:res.aveScore<0?0:res.aveScore,
463-
avePre:res.avePre<0?0:res.avePre,
464-
aveRec:res.aveRec<0?0:res.aveRec,
465-
aveFai:res.aveFai<0?0:res.aveFai,
466-
aveRel:res.aveRel<0?0:res.aveRel,
467-
aveLcs:res.aveLcs<0?0:res.aveLcs,
468-
aveLeve:res.aveLeve<0?0:res.aveLeve,
469-
aveJac:res.aveJac<0?0:res.aveJac,
465+
aveScore: safe(aveScore),
466+
avePre: safe(avePre),
467+
aveRec: safe(aveRec),
468+
aveFai: safe(aveFai),
469+
aveRel: safe(aveRel),
470+
aveLcs: safe(aveLcs),
471+
aveLeve: safe(aveLeve),
472+
aveJac: safe(aveJac),
470473
};
471-
testCaseList.value = res.testCases;
472-
totalCount.value = res.total;
474+
testCaseList.value = testCases;
475+
totalCount.value = total;
473476
}).finally(() => {
474477
// 初始化图表
475478
initChart();

0 commit comments

Comments
 (0)