This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch be-logs-api-3
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/be-logs-api-3 by this push:
new a93765d2b fix: update progress percentage calculation
a93765d2b is described below
commit a93765d2b9855a6e05e89be3a0eb50b61e78ae18
Author: abeizn <[email protected]>
AuthorDate: Wed Mar 27 11:22:24 2024 +0800
fix: update progress percentage calculation
---
backend/server/services/task.go | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/backend/server/services/task.go b/backend/server/services/task.go
index 91989df9c..e3d043683 100644
--- a/backend/server/services/task.go
+++ b/backend/server/services/task.go
@@ -303,9 +303,9 @@ func GetSubTasksInfo(pipelineId uint64, shouldSanitize
bool, tx dal.Dal) (*model
}
subtasksInfo = append(subtasksInfo, subTaskResult)
- collectSubtasksCount :=
errors.Must1(tx.Count(dal.From("_devlake_subtasks"), dal.Where("task_id = ?",
task.ID)))
+ collectSubtasksCount :=
errors.Must1(tx.Count(dal.From("_devlake_subtasks"), dal.Where("task_id = ? and
is_collector = 1", task.ID)))
totalSubtasksCount += collectSubtasksCount
- finishedSubTasksCount :=
errors.Must1(tx.Count(dal.From("_devlake_subtasks"), dal.Where("task_id = ? and
finished_at is not null", task.ID)))
+ finishedSubTasksCount :=
errors.Must1(tx.Count(dal.From("_devlake_subtasks"), dal.Where("task_id = ? and
is_collector = 1 and finished_at is not null", task.ID)))
totalFinishedSubTasksCount += finishedSubTasksCount
count++
@@ -317,7 +317,6 @@ func GetSubTasksInfo(pipelineId uint64, shouldSanitize
bool, tx dal.Dal) (*model
subTasksOuput.SubtasksInfo = subtasksInfo
subTasksOuput.Count = totalSubtasksCount
-
completionRateFloat := float64(totalFinishedSubTasksCount) /
float64(totalSubtasksCount)
roundedCompletionRate := math.Round(completionRateFloat*100) / 100
subTasksOuput.CompletionRate = roundedCompletionRate