mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-25 01:04:02 +08:00
Merge pull request #7176 from sboursen-scinote/sb_SCI-10333
Fix progress bar value when Experiment has no tasks [SCI-10333]
This commit is contained in:
commit
74e1478c07
1 changed files with 11 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="relative leading-5 h-full flex items-center">
|
||||
<div>
|
||||
<div>
|
||||
{{ i18n.t('experiments.card.completed_value', {
|
||||
completed: params.data.completed_tasks,
|
||||
all: params.data.total_tasks
|
||||
|
@ -8,7 +8,7 @@
|
|||
<div class="py-1">
|
||||
<div class="w-24 h-1 bg-sn-light-grey">
|
||||
<div class="h-full bg-sn-blue" :style="{
|
||||
width: params.data.completed_tasks / params.data.total_tasks * 100 + '%'
|
||||
width: `${progress}%`
|
||||
}"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -24,5 +24,14 @@ export default {
|
|||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
progress() {
|
||||
const { completed_tasks: completedTasks, total_tasks: totalTasks } = this.params.data;
|
||||
|
||||
if (totalTasks === 0) return 0;
|
||||
|
||||
return (completedTasks / totalTasks) * 100;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue