John Dong [Fri, 17 Aug 2007 23:18:05 +0000 (19:18 -0400)]
* Add a few testcases for checking for nonexistent things
* Change helpers to be a bit more streamlined in the way they handle assertions failures vs unexpected exceptions.
John Dong [Fri, 17 Aug 2007 23:16:34 +0000 (19:16 -0400)]
Improve consistency of XMLRPC error reporting. Now, all error conditions will raise an exception. Before, there was an inconsistent mix between raising exceptions and returning nil objects. Nil objects are much less desirable because the client must explicitly check for errors and some errors might silently pass through and produce incorrect results
Added Sparklines controller and dependency, see README. Created method and table for margins of victory (i.e won by how much) and ties, in rubyvote, has already been svn'd.
John Dong [Fri, 17 Aug 2007 20:25:31 +0000 (16:25 -0400)]
* Refactor checking proper quickvote creation to helper assert_create_quickvote_succeeds
* Remove a crufty assertion from XML checker -- it is redundant
* Add testcase for a description with binary characters
John Dong [Fri, 17 Aug 2007 20:15:45 +0000 (16:15 -0400)]
* Add one more assertion in testcase for dupe candidates
* Remove test_create_quickvote_description_htmlescape. As I thought earlier, I actually want the DB to properly store HTML elements. It's the job of the view to make sure it doesn't clobber itself displaying the element.
- Change the test instead to a test for proper XML escaping. An appended </string> element should be stored properly and not trip hell
John Dong [Fri, 17 Aug 2007 20:02:31 +0000 (16:02 -0400)]
* Refactor testcase code -- create_quickvote_fails assertion -- was using same block of code repetivitely
Add more testcases for improper data
* Passing in a nil ElectionStruct to quickvotes
* Passing in only nil {name, description, candidates}
* Passing in whitespace for name, description, candidates
* Passing in duplicate candidates
* Passing in dirty HTML in description field
- IMO this may not be a "bug" -- we should rather assert that the view will not be injected with HTML. It may be desirable (a feature) to store HTML-ish text in the database.
John Dong [Fri, 17 Aug 2007 00:20:16 +0000 (20:20 -0400)]
XMLRPC Vote Casting Validation:
* Can only vote for candidate_id's within the current election
* Can only rank each candidate once
* Must rank all candidates
The defeats lsit partial contains the display logic for the mehtod added to condorcet.rb taht helps print out a list of who defeated who and by how much. I also modified the tab;e in _pref_table.rhtml to use names as the table headers and notcandidate id's. Finally, results.rhtml has been updated to display them.
John Dong [Thu, 16 Aug 2007 20:11:31 +0000 (16:11 -0400)]
* Display DNS instead of IP address
* Convert old DNS field to WHOIS OrganizationName field.
* Btter handle invalid IP's, including proper display of XMLRPC voters
John Dong [Thu, 16 Aug 2007 19:45:16 +0000 (15:45 -0400)]
Disallow identical candidates to be added to a quickvote. Differently cased identical strings are still allowed. This of course makes Asdf and asdf impossible to tell apart in the vote, which is kind of a bug. We should think of some way of differentiating those
John Dong [Thu, 16 Aug 2007 17:54:37 +0000 (13:54 -0400)]
* Tighter validation, closed a number of crashes due to invalid data
* Security: Escape HTML to prevent injection of code onto the form
* Prevent empty candidates from passing validation
* Clearer, non Engrishy error messages on quickvote/create
* Prevent quickvote ident names from clashing with reserved controller actions
Modified graphs to ahve a 4 color scheme, but it isn't the full palette of selectricity yet
, that will be on next commit. LAso modified several voting methods within RubyVote to have
more useful instance variables and accessors available in the results class. the quickvote
results view has been updated to include a partial for displaying a condorcet vote table, w
hich is strangely appearing below the footer on the results page, it seems to be displaying
the correct data however.
John Dong [Wed, 15 Aug 2007 19:12:41 +0000 (15:12 -0400)]
Commit partial implementation of casting quickvotes via xmlrpc. WARNING: Currently I think it creates inconsistent objects in the database that'll screw up voting.
John Dong [Tue, 14 Aug 2007 20:51:15 +0000 (16:51 -0400)]
* Changed XMLRPC API to use arrays of ID's to report results
* Add a list of names and ID's to the results struct, for future translation purposes to canonical names
Fixed choices_positions to use GruffGraff class. Initialize method now had a way of
dealign with multiple data arrays being passed in. Next need to compensate for giving each set of data it's own name, possible a hash with "name" => data as the key, value pairs...
Added the choices position and get_posititons_info to graph controller. Right now, since
the graph graphs a different set of data for each candidate, the data function has to be
called multiple times and I'm not sure how to do it/if it's possible within the class
definition. As such, I've defined everything within the choices_position method for now.
I'll be trying to figure out the kinks next. Overall, the graph is very confusing and
might not be very useful in the end, but the data it uses is.
Added a new bar graph, that counts how many points the borda system of
voting has asssigned to every candidate, it shows the margins fo victory
and loss clearly. Also had to make modifications to the RubyVote libary.
There was an error in BordaVote that prevented it from working correctly,
which has been fixed. Also added an attr_reader to BordaResult for
ranked_candidates. About to delete the Gruff Plugin v 0.1.2 and replace it
with Gruff gem v 0.2.8.
Removed the two methods from Application controller which were redundant -
the main version are in the graph controller. Started to add a borda bar
graph results method, when it came to our attention that the borda method
was most likely broken, counting only the most recent vote. Have added an attr_reader :election to Class Electionresults in rubyvote. About to attempt to fix the Borda method.