Finished organzing preferential vote tables into one partial. Also changed RubyVote's victories_and_ties method to return a hash of hashes which stores both victories and ties.
John Dong [Mon, 20 Aug 2007 19:56:39 +0000 (15:56 -0400)]
* Fix the session_id accessor. Previous version looks for wrong method
* Added new testcases
- Creating same-name quickvote
- Test retrieving results of quickvotes with 0, 1, and 5 votes
- Test casting a quickvote
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