private static void MailRawElectionResults(MeetingElection poll, SchulzeProcessor processor, bool stillOpen) { MeetingElectionCandidates candidates = processor.FinalOrder; Dictionary <int, bool> dropoutLookup = new Dictionary <int, bool>(); // TODO SOMETIME: implement and populate dropouts here string body = "These are " + (stillOpen ? "intermediate" : "THE FINAL") + " results for the poll \"" + poll.Name + "\". Note that the Dist field is purely informative and not part of the Schulze ranking.\r\n\r\n"; body += "Rank Dist Candidate\r\n"; for (int candidateIndex = 0; candidateIndex < candidates.Count; candidateIndex++) { int distance = processor.GetCandidateDistance(candidateIndex); body += String.Format("{0:D3}. {1} {2}{3}\r\n", candidateIndex + 1, (distance > 0 ? distance.ToString("D4") : "----"), candidates[candidateIndex].Person.Canonical, dropoutLookup.ContainsKey(candidates[candidateIndex].PersonId) ? " [hoppat av]" : string.Empty); } int[] recipients = new int[] { 1, poll.CreatedByPersonId }; // Send to Rick too while stabilizing functionality -- remove as soon as Rick is running in any poll string subject = (stillOpen ? "Intermediate" : "FINAL") + " results for poll - " + poll.Name; foreach (int personId in recipients) { Person.FromIdentity(personId).SendNotice( subject, body, Organization.PPSEid); } }
static private void ReportPollResults(MeetingElection poll, bool stillOpen) { SchulzeProcessor processor = new SchulzeProcessor(); processor.Candidates = poll.Candidates; processor.Votes = MeetingElectionVotes.ForInternalPoll(poll); processor.Process(); MailRawElectionResults(poll, processor, stillOpen); }
private static void MailRawElectionResults(MeetingElection poll, SchulzeProcessor processor, bool stillOpen) { MeetingElectionCandidates candidates = processor.FinalOrder; Dictionary<int, bool> dropoutLookup = new Dictionary<int, bool>(); // TODO SOMETIME: implement and populate dropouts here string body = "These are " + (stillOpen ? "intermediate" : "THE FINAL") + " results for the poll \"" + poll.Name + "\". Note that the Dist field is purely informative and not part of the Schulze ranking.\r\n\r\n"; body += "Rank Dist Candidate\r\n"; for (int candidateIndex = 0; candidateIndex < candidates.Count; candidateIndex++) { int distance = processor.GetCandidateDistance(candidateIndex); body += String.Format("{0:D3}. {1} {2}{3}\r\n", candidateIndex + 1, (distance > 0 ? distance.ToString("D4") : "----"), candidates[candidateIndex].Person.Canonical, dropoutLookup.ContainsKey(candidates[candidateIndex].PersonId) ? " [hoppat av]" : string.Empty); } int[] recipients = new int[] { 1 , poll.CreatedByPersonId }; // Send to Rick too while stabilizing functionality -- remove as soon as Rick is running in any poll string subject = (stillOpen ? "Intermediate" : "FINAL") + " results for poll - " + poll.Name; foreach (int personId in recipients) { Person.FromIdentity(personId).SendNotice( subject, body, Organization.PPSEid); } }
static private void ReportPollResults (MeetingElection poll, bool stillOpen) { SchulzeProcessor processor = new SchulzeProcessor(); processor.Candidates = poll.Candidates; processor.Votes = MeetingElectionVotes.ForInternalPoll(poll); processor.Process(); MailRawElectionResults(poll, processor, stillOpen); }