Calculate how many people everyoneAt will send to
In previous versions of send message we knew how many people we were sending to because we loaded every person into the dropdown.
When we changed to using the select2-search module we lost this functionality.
It's probably important, and SMS cost money. We should consider adding it back.
It is slightly tricky:
- In the old version this was inline in the drop-down. You would see Mukono - send to 31 recipients. If we wanted to replicate this we'd need to solve it in real-time as select2search resolved search results.
- To do that in a non-terrible way it would need to be server side, because we don't want to have a very chatty app.
- True phone validity uses a google library. If we wanted this to be server side we'd need to make a massive view map fn, which seems terrible.
- Doing it client side would require loading at least the id and phone number of every child of a given id. There is no existing view that does this, though you may be able to combine views. A simpler version would be to just load the full docs.
- Note that already are doing this when we get around to generating the task (
services/send-message.js:decendents()). This currently happens after the user has finished with the UI, on the minimum set (ie actual selected parents, not potentials). We could arguably get rid of this as well, if we had a useful view returning only the minimum set of data.
Some options:
- Create a view--probably with a map and a reduce--dedicated to optimally returning the number of callable contacts for a given parent. Unless we used google's library on couchdb this would be only the number of potentially valid (ie non empty) phone numbers and not the true value. Make this a post-processing step in select2search: though it's not clear exactly how (obvious places to hook in that don't complicate select2search by adding features that only one person needs don't have a select2 callback, so we'd literally need to block!)
- On selecting an everyoneAt contact use Some Method™ to asynchronously update the selection tag with the number of actual contacts
- On hitting send have a secondary step using Some Method™ which calculates how many SMS you're sending and get the user to confirm
Where Some Method™ is anything from an optimal map / reduce view to loading all docs and doing it on the client side.
@abbyad / @sglangevin would be interested in your thoughts about the importance of this.
Apparently I missed the tag on this issue a while back. I do think this is something we should implement for SMS projects. In the past, I'm not sure if sending to groups worked as expected, but the last time I tested it was on v0.5 so a lot has changed.
Hi @rmhowe,
This ticket has not been touched in 90 days. Is it still relevant?
Please also ensure this ticket has a Priority, Status and Type label.(See triaging old issues for more detail)
@SCdF @sglangevin sounds like this is a desired feature, low priority for 3.1?
@rmhowe I think we should yeah. The only thing that would dissuade me from thinking this was important was if we were replacing it with some kind of different messaging system / ui / paradigm soon (remember the Diani conversations?), but that felt very… far away.
Devil's advocate: no one has complained for all of 2.x that this doesn't work, so either no one uses the feature at all, or people don't care how much stuff costs
Actually someone has complained about this - it's a feature that our MoH deployments in Nepal want to use. I don't think anyone has asked us to calculate the cost, but messaging a group of people is currently broken. If you select a place to message, the SMS only goes to the primary contact of that place. I'd consider that a bug and it may need to be a separate ticket.