gdoteof/election — Issue #2: Provide Percentage for Ballot Item Results
Author: bradley-holt
Created: 2012-01-23 20:54:34+00:00
State: open

### Description

In addition to the number of votes, please provide the percentage of the total votes that those votes represent for each ballot item result.

### Steps to Reproduce

curl 'https://example.org/town-meeting-season-2011/town-meeting-day-2011/city-of-burlington' \
-H 'Accept: application/json'`

### Actual Results

```json
{
"title":"City of Burlington",
…
"ballot_item_results":{
…
"113838":{
"text":"Approval of Increase in Maximum Tax Rate for…",
"results":{
"Yes":1849,
"No":4047
}
},
…
}
…
}
```

### Expected Results

```json
{
"title":"City of Burlington",
…
"ballot_item_results":{
…
"113838":{
"text":"Approval of Increase in Maximum Tax Rate for…",
"results":{
"Yes":{
"votes":1849,
"percent":31.4
},
"No":{
"votes":4047,
"percent":68.6
}
}
},
…
}
…
}
```

### Additional Comments

The benefits of having this in the JSON, as opposed to calculated in JavaScript, include:

* Consistency of rounding in HTML and JavaScript
* Allows the module to determine the precision in one place
* Reduced duplication of logic