Closed mhulse closed 9 years ago
Rob's first go at it:
[
{
"contest": "US Senate",
"total": 400,
"options": [
{
"option":"Yes",
"votes": 137,
"percent": 34.25
},
{
"option":"No",
"votes": 341,
"percent": 85.25
}
]
},
{
"contest": "US Rep 4th District",
"total": 500,
"options": [
{
"option":"Yes",
"votes": 200,
"percent": 40
},
{
"option":"No",
"votes": 100,
"percent": 20
}
]
}
]
Add:
Note to self: For parsing/templating/MVC, http://knockoutjs.com maybe? Need to explore.
Nice work on this first draft of the JSON output John: http://projects.registerguard.com/ballot/json/
:+1: and adding (above) link to issue for future reference.
JSONP feed info items to be integrated into display:
explainer_text
Feed tweaks:
extra_cand_meas_text
image_url
and takes up to 300 characters/top
feed where we pick the "top" race(s) and measures via checkbox.
Django - clear cache on model save - the lightweight way (hamfisted — clobbers entire cache — but lightweight ... ) https://gist.github.com/centralniak/1100130 https://github.com/registerguard/django-ad-manager/blob/master/ad_manager/mixins/views.py
Interesting Concentric Sky code (but not really what I'm looking for): https://github.com/concentricsky/django-cachemodel
Just so I have the key/values:
Just curious, why do some of the "votes" in this:
http://projects.registerguard.com/ballot/json/region/
Say "None"?
As for key/values, the JSON(P) feeds have an affiliation_pretty
key, where the value is the full name. Does that take care of the issue?
You get a value of None
until a value of 0
gets recorded by an updating script or fat-fingered in via the admin.
Yup, affiliation_pretty
is useful. I am using both actually. IIRC, I ended up checking for !== "none'
and !== ""
to get around some of the issues I was having. All is good now.
Thanks for clarification.
With that said, I think this issue is complete. Everything has been checked off above lists (just need to refine styles and cross-browser test).
Closing! :+1:
Thinking about it now, running a python manage.py ballot_test_data_in
(then python manage.py ballot_test_data_reset
) would've removed the None
s.
I think the None
s must've been the Region races/measures I added late last week and I never inserted/deleted test data into them, so they still had that virgin None
state.
Ah, I see. No worries. 😃
I really want to make sure my JS is updating results correctly, so we'll have to do some thorough checking.
Tools to maybe utilize: