Update aggregate API to use binary megabytes and enhance documentation
- Changed API responses and internal calculations to use binary megabytes (MiB) instead of octets for traffic metrics. - Updated relevant endpoints in AGGREGATE.md to reflect the new metric units. - Modified handler and merge logic to accommodate the new data structure and ensure accurate traffic reporting. - Enhanced tests to validate the changes in traffic calculations and summary data. - Deprecated the use of total_octets in favor of total_megabytes for consistency across the API.
This commit is contained in:
@@ -164,8 +164,12 @@ func (h *Handler) handleUsers(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
includeLinks := strings.EqualFold(r.URL.Query().Get("include_links"), "true")
|
||||
minOct := uint64(0)
|
||||
if v := r.URL.Query().Get("min_total_octets"); v != "" {
|
||||
var minOct uint64
|
||||
if v := r.URL.Query().Get("min_total_megabytes"); v != "" {
|
||||
if n, err := strconv.ParseFloat(v, 64); err == nil && n > 0 {
|
||||
minOct = uint64(n * float64(mebibyte))
|
||||
}
|
||||
} else if v := r.URL.Query().Get("min_total_octets"); v != "" {
|
||||
if n, err := strconv.ParseUint(v, 10, 64); err == nil {
|
||||
minOct = n
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user