Use consistent criteria for public alerts and preferred events
requested to merge leo-singer/gwcelery:consistent-preferred-event-and-public-alert-criteria into master
We define a total ordering over events in order to select the preferred event. The ordering is defined through a key function that returns a tuple, the first element of which is the boolean value indicating whether a public alert would be sent.
This fixes a whole class of bugs where the choice of the preferred event could inhibit sending a public alert. Such bugs are now impossible, by construction.
Fixes !471 (merged).