Skip to content

Commit

Permalink
fix: calc counts for timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
MishkaRogachev committed Jul 31, 2023
1 parent d24d326 commit c16a95e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions protocol/messenger_community_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (m *Messenger) collectCommunityMessagesTimestamps(request *requests.Communi
StartTimestamp: sourceInterval.StartTimestamp,
EndTimestamp: sourceInterval.EndTimestamp,
Timestamps: timestamps,
Count: len(timestamps),
}
}

Expand Down
4 changes: 4 additions & 0 deletions protocol/messenger_community_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ func (s *MessengerCommunityMetricsSuite) TestCollectCommunityMessagesTimestamps(

s.Require().Len(resp.Intervals, 3)

s.Require().Equal(resp.Intervals[0].Count, 3)
s.Require().Equal(resp.Intervals[1].Count, 2)
s.Require().Equal(resp.Intervals[2].Count, 1)

s.Require().Equal(resp.Intervals[0].Timestamps, []uint64{1690372000, 1690372100, 1690372200})
s.Require().Equal(resp.Intervals[1].Timestamps, []uint64{1690372700, 1690372800})
s.Require().Equal(resp.Intervals[2].Timestamps, []uint64{1690373000})
Expand Down

0 comments on commit c16a95e

Please sign in to comment.