diff --git a/tasks/watergroup/month.go b/tasks/watergroup/month.go index b8ff4a0..971df23 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 f2daa61..b8df0c9 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 d3c94b0..aba255a 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 184a1e1..b932756 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 } }