diff --git a/tasks/watergroup/month.go b/tasks/watergroup/month.go index b8ff4a05..971df23e 100644 --- a/tasks/watergroup/month.go +++ b/tasks/watergroup/month.go @@ -79,7 +79,7 @@ func dealMonth(gid string) { var medianCount int64 for idx, v := range records { msgCount += v.Count - if idx == len(records)/2 { + if idx == (len(records)/2)-1 { medianCount = v.Count } } diff --git a/tasks/watergroup/week.go b/tasks/watergroup/week.go index f2daa61f..b8df0c95 100644 --- a/tasks/watergroup/week.go +++ b/tasks/watergroup/week.go @@ -78,7 +78,7 @@ func dealWeek(gid string) { var medianCount int64 for idx, v := range records { msgCount += v.Count - if idx == len(records)/2 { + if idx == (len(records)/2)-1 { medianCount = v.Count } } diff --git a/tasks/watergroup/year.go b/tasks/watergroup/year.go index d3c94b08..aba255a1 100644 --- a/tasks/watergroup/year.go +++ b/tasks/watergroup/year.go @@ -78,7 +78,7 @@ func dealYear(gid string) { var medianCount int64 for idx, v := range records { msgCount += v.Count - if idx == len(records)/2 { + if idx == (len(records)/2)-1 { medianCount = v.Count } } diff --git a/tasks/watergroup/yesterday.go b/tasks/watergroup/yesterday.go index 184a1e16..b932756a 100644 --- a/tasks/watergroup/yesterday.go +++ b/tasks/watergroup/yesterday.go @@ -80,7 +80,7 @@ func dealYesterday(gid string) { var medianCount int64 for idx, v := range records { msgCount += v.Count - if idx == len(records)/2 { + if idx == (len(records)/2)-1 { medianCount = v.Count } }