Acs , Desc handling for custom char calculation
This commit is contained in:
parent
d8b403302d
commit
c19eb10311
BIN
pb_data/data.db
BIN
pb_data/data.db
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
pb_data/logs.db
BIN
pb_data/logs.db
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -434,6 +434,7 @@ type ChartCalculationRequest struct {
|
||||
AdditionalForGroupByAndSum string `json:"additional_for_groupby_and_sum"`
|
||||
GetTop string `json:"get_top"`
|
||||
SortBy string `json:"sort_by"`
|
||||
SortAction string `json:"sort_action"`
|
||||
Conversion string `json:"conversion"`
|
||||
}
|
||||
|
||||
@ -475,7 +476,12 @@ func CalculateGroupedSum(observations []Observation, request ChartCalculationReq
|
||||
val1, _ := strconv.ParseFloat(val1Str, 64)
|
||||
val2, _ := strconv.ParseFloat(val2Str, 64)
|
||||
|
||||
return val1 > val2 // Descending order
|
||||
sortActionKey := request.SortAction
|
||||
if sortActionKey == "DESC" {
|
||||
return val1 > val2 // Descending order
|
||||
}
|
||||
return val1 < val2 // Ascending order
|
||||
|
||||
})
|
||||
} else {
|
||||
// Default sorting by ObsValue.Value
|
||||
@ -553,7 +559,11 @@ func CalculateGroupedSum(observations []Observation, request ChartCalculationReq
|
||||
val1, _ := strconv.ParseFloat(val1Str, 64)
|
||||
val2, _ := strconv.ParseFloat(val2Str, 64)
|
||||
|
||||
return val1 > val2 // Descending order
|
||||
sortActionKey := request.SortAction
|
||||
if sortActionKey == "DESC" {
|
||||
return val1 > val2 // Descending order
|
||||
}
|
||||
return val1 < val2 // Ascending order
|
||||
})
|
||||
} else {
|
||||
// Default sorting by ObsValue.Value
|
||||
|
||||
Loading…
Reference in New Issue
Block a user