fix project progress being rounded down.
This commit is contained in:
@@ -36,9 +36,9 @@ type Result struct {
|
||||
entities.Project
|
||||
OwnerName string `json:"ownerName"`
|
||||
StatusName string `json:"statusName"`
|
||||
TotalAcquired int `json:"totalAcquired"`
|
||||
TotalRequired int `json:"totalRequired"`
|
||||
TotalPlanned int `json:"totalPlanned"`
|
||||
TotalAcquired float64 `json:"totalAcquired"`
|
||||
TotalRequired float64 `json:"totalRequired"`
|
||||
TotalPlanned float64 `json:"totalPlanned"`
|
||||
Requirements []RequirementResult `json:"requirements"`
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ type RequirementResult struct {
|
||||
Description string `json:"description"`
|
||||
Status models.Status `json:"status"`
|
||||
StatusName string `json:"statusName"`
|
||||
TotalAcquired int `json:"totalAcquired"`
|
||||
TotalRequired int `json:"totalRequired"`
|
||||
TotalPlanned int `json:"totalPlanned"`
|
||||
TotalAcquired float64 `json:"totalAcquired"`
|
||||
TotalRequired float64 `json:"totalRequired"`
|
||||
TotalPlanned float64 `json:"totalPlanned"`
|
||||
IsCoarse bool `json:"isCoarse"`
|
||||
Stats []RequirementResultStat `json:"stats"`
|
||||
Items []items.Result `json:"items"`
|
||||
@@ -243,9 +243,9 @@ func generateRequirementResult(req entities.Requirement, scope scopes.Result, re
|
||||
totalPlanned += math.Min(float64(stat.Planned), float64(stat.Required)) * stat.Weight
|
||||
}
|
||||
}
|
||||
resReq.TotalRequired += int(totalRequired)
|
||||
resReq.TotalAcquired += int(math.Min(totalAcquired, totalRequired))
|
||||
resReq.TotalPlanned += int(math.Min(totalPlanned, totalRequired))
|
||||
resReq.TotalRequired += totalRequired
|
||||
resReq.TotalAcquired += math.Min(totalAcquired, totalRequired)
|
||||
resReq.TotalPlanned += math.Min(totalPlanned, totalRequired)
|
||||
|
||||
return resReq
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user