[#185] Resolve "Bug: hotline messages counted as broadcast mesages"
Closes #185 (closed)
Context
- We currently count incoming hotline messages as broadcast messages, which is bad because it skews our "broadcastOut" numbers a lot (by multiplying every hotline message by number of subscribers instead of number of admins, so it looks like a lot more broadcast messages went out than actually did)
- Plus it would be nice to have visibility into how many incoming hotline messages v. outgoing broadcast messages are happening overall to develop a better intuition for how people use the app
Changes
- create new
messageCount
fields forhotlineIn
/hotlineOut
- increment them appropriately after forwarding a hotline message
- modify the response to
boost list-channels
to:- sort by number of subscribers, descending (instead of by
broadcastOut
, which is a dumb metric anyway!) - show
broadcastIn
,hotlineIn
, andcommandIn
counts for each channel (don't showbroadcastOut
)
- sort by number of subscribers, descending (instead of by
- zero out all
messageCount
s for all channels and start fresh with clean (no-bug) counts
Implementation Notes
- add hotline fields to
messageCount
table/model - extract all counting logic to
repositories.messageCount
(eliminate helpers fromdispatcher.messenger
) - add
respositories.messageCount.countHotline
and call it inmessenger.relayHotlineMessage
- lleanup tail end of
relayHotlineMessage
to avoid double counting an incoming hotline message as a command
- lleanup tail end of
- modify
repository.channel.findAllDeep
to not sort by anything - modify
registrar.channel._formatForList
to showbroadCastIn
andhotlineIn
and sort by subscribers - add a migration to set all messageCounts to zero and start fresh with clean data