@@ -69,24 +69,24 @@ func buildTopVenuesMessageBlocks(monthlyTopVenues []order.VenueOrderCount, month
6969 return topVenuesBlocks , nil
7070}
7171
72- func buildTopHostsMessageBlocks (monthlyTopHosts []order.HostOrderCount , monthlyTopHostsTotalCounts []order.HostOrderCount ) ([]slack.Block , error ) {
73- hostIdToTotalOrderCount := make (map [string ]int )
72+ func buildTopHostsMessageBlocks (monthlyTopHosts []order.MouthsFedCount , monthlyTopHostsTotalCounts []order.MouthsFedCount ) ([]slack.Block , error ) {
73+ hostIdToTotalMouthsFedCount := make (map [string ]int )
7474 for _ , host := range monthlyTopHostsTotalCounts {
75- hostIdToTotalOrderCount [host .HostId ] = host .OrderCount
75+ hostIdToTotalMouthsFedCount [host .HostId ] = host .MouthsFedCount
7676 }
7777
7878 topHostsHeader := slack .NewSectionBlock (
7979 nil ,
8080 []* slack.TextBlockObject {
81- slack .NewTextBlockObject ("mrkdwn" , ":star : *Top hosts *" , false , false ),
81+ slack .NewTextBlockObject ("mrkdwn" , ":spoon : *Most mouths fed *" , false , false ),
8282 slack .NewTextBlockObject ("mrkdwn" , fmt .Sprintf ("*%s (Total)*" , dateOneMonthAgo .Month ().String ()), false , false ),
8383 },
8484 nil ,
8585 )
8686
8787 topHostsRows := make ([]* slack.TextBlockObject , 0 , len (monthlyTopHosts )* 2 )
8888 for i , host := range monthlyTopHosts {
89- totalOrderCount , hostExists := hostIdToTotalOrderCount [host .HostId ]
89+ totalMouthsFedCount , hostExists := hostIdToTotalMouthsFedCount [host .HostId ]
9090 if ! hostExists {
9191 return nil , fmt .Errorf ("host %s (%s) is not in monthlyTopHostsTotalCounts" , host .HostId , host .HostName )
9292 }
@@ -97,11 +97,11 @@ func buildTopHostsMessageBlocks(monthlyTopHosts []order.HostOrderCount, monthlyT
9797 }
9898
9999 leftColumnString := fmt .Sprintf ("%s %s%s%s" , positionEmoji , UnicodeLeftToRightMark , host .HostName , UnicodeLeftToRightMark )
100- if host .OrderCount == totalOrderCount {
100+ if host .MouthsFedCount == totalMouthsFedCount {
101101 leftColumnString += " :new:"
102102 }
103103
104- rightColumnString := fmt .Sprintf ("%d (%d)" , host .OrderCount , totalOrderCount )
104+ rightColumnString := fmt .Sprintf ("%d (%d)" , host .MouthsFedCount , totalMouthsFedCount )
105105
106106 topHostsRows = append (topHostsRows ,
107107 slack .NewTextBlockObject ("mrkdwn" , leftColumnString , false , false ),
@@ -125,10 +125,10 @@ func venueOrderCountsToVenueIds(venueOrderCounts []order.VenueOrderCount) []stri
125125 return venueIds
126126}
127127
128- func hostOrderCountsToHostIds ( hostOrderCounts []order.HostOrderCount ) []string {
128+ func mouthsFedCountsToHostIds ( mouthsFedCounts []order.MouthsFedCount ) []string {
129129 var hostIds []string
130- for _ , hostOrderCount := range hostOrderCounts {
131- hostIds = append (hostIds , hostOrderCount .HostId )
130+ for _ , mouthsFedCount := range mouthsFedCounts {
131+ hostIds = append (hostIds , mouthsFedCount .HostId )
132132 }
133133 return hostIds
134134}
@@ -149,13 +149,13 @@ func (h *Service) getTopVenuesMessageBlocks(channelId string) ([]slack.Block, er
149149}
150150
151151func (h * Service ) getTopHostsMessageBlocks (channelId string ) ([]slack.Block , error ) {
152- monthlyTopHosts , err := h .orderStore .GetHostsWithMostOrders (dateOneMonthAgo , numberOfDigestRows , channelId , []string {})
152+ monthlyTopHosts , err := h .orderStore .GetHostsWithMostMouthsFed (dateOneMonthAgo , numberOfDigestRows , channelId , []string {})
153153 if err != nil {
154154 return nil , fmt .Errorf ("error getting top hosts of the last month: %w" , err )
155155 }
156156
157- monthlyTopHostIds := hostOrderCountsToHostIds (monthlyTopHosts )
158- monthlyTopHostsTotalCounts , err := h .orderStore .GetHostsWithMostOrders (time.Time {}, numberOfDigestRows , channelId , monthlyTopHostIds )
157+ monthlyTopHostIds := mouthsFedCountsToHostIds (monthlyTopHosts )
158+ monthlyTopHostsTotalCounts , err := h .orderStore .GetHostsWithMostMouthsFed (time.Time {}, numberOfDigestRows , channelId , monthlyTopHostIds )
159159 if err != nil {
160160 return nil , fmt .Errorf ("error getting top hosts of all time: %w" , err )
161161 }
0 commit comments