Created a partial to DRY the aja voting method. Modified the voter class to
have both a FullVoter and QuickVoter `types`. Also changed the index and review
methods so that they are more error resistant in the face of ajax voting.
Application.rb now includes the sort_candidates method from
quickvote_controller so all election types can use it. Also updated the
election results pages so that they don't throw errors any more. (Show and Hide
details)
Allowed for the results page of quickvotes to be hidden while the quickvote is go
ing on. Also added a 'notices' option to QuickVotes available only to logged in u
sers. Those two options were added to the elections table, so they should be easy
to extend to full elections. Also redid some logic on the layout and index.
Added Plugin for dynamically adjusting session options (so they will never
expire). The code for that, along with a change of the session_key, which
changes how the cookies hash stores teh session_id, are both in the environment
file.
Added a method, views, and corresponding route so that a user can track the
quickvotes he has created by his session_id. Have yet to modify the cookies to
stick around permanently.
<mako@atdot.cc> [Thu, 23 Aug 2007 19:45:11 +0000 (15:45 -0400)]
Big commit includes:
* A bunch of cleanup of the unit tests.
* Addition of fixtures for elections and candidates.
* Cleanup of the selectricitservice model.
* Additional tweaks for testing including addition of ruby-debug for
testing.
Allow custimizable graph sizes, to fit with newly modular results page. Also,
beginning a method that will allow users to track the QuickVotes they create.
John Dong [Tue, 21 Aug 2007 19:12:02 +0000 (15:12 -0400)]
Revise functional test of graph controller for retrieving an unknown id number. Currently I think raising RecordNotFound is fine. The alternate would be to generate a record not found PNG, but I don't see the point of doing that either.
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.