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
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.
Updated the "votes_per_day" method in graph controller to work better and
read easier. Also, with Mako's insistence and help, wrote the "votes_per_interval" method (and helpers) in graph controller. The worst part of that
method is when I assign names to the labels_hash, ideas welcome, but it
works for now. Even though the graph uses fixed intervals and is named
"votes_per_interval" it actually shows votes over time (per interval),
so I may rename it in the near future (in fact I would've renamed it for
this commit, but I didn't think till I was writing this statement.)
<mako@atdot.cc> [Tue, 7 Aug 2007 23:23:05 +0000 (19:23 -0400)]
Modified QuickVote table to work by object type and not by the weird
TinyInts so that we can take advantage of the single table inheritence
magic in AR.
The user model has been modified so that it stores the user object itself in the session[:user]. Session[:user_id] fulfills the purpose of holding the specific id. the test files were also modified to account for the changes. In addition, a couple lines in the SiteController#index method were updated tp utilize new funtionality of ActiveRecord. The changes I made to the Authenitcated user library is available here:http://technoweenie.stikipad.com/plugins/show/Storing+the+User+Model+in+the+Session.
Changed the Selectricity header into a link, and modified the config/routes.rb file to include a new named route: "graph." Use graph_url syntax to call a Gruff method from the graphs controller. Currently about to troubleshoot the user system.
Modified the methods in graphs controller so they would work for Selectricity, but can't get them to successfully display yet. It seems that the 'url_for' helper might not be able to handle a :controller an argument. It doesn't throw an error, just displays nothing. I also removed various deprecated methods and replaced them with their updated counterparts in site_controller, and in some of the views. In addition I modified the confirm method in the QuickVote controller to save the time of the vote. I also changed what the voter.ip was logging because it wasn't working. Currently it says request.env["BLAH"] because I'm trying to vote multiple times in the same election for testing (not sure that jsut cahgnign the ip save feature is allowing that) but it will have to be request.env["REMOTE_ADDR"] in the long run. This is on line 108 of the QuickVote controller.
Well, it seems I forgot to add the acts_as_authenticated to the repository on my last commit, but they're there now. Also, I recently added the Gruff graphing plugin, and created a new controller for the graphs, with a method I ported from pollarize to chart how many people have voted per day. The basic_login page works, and the create user sstem works, but is unpolished and still points to a poem as the index page, so if you read a poem, it's supposed to happen. The quickvote creation from the homepage is NOT working however, and is about to be investigated. I'm not sure how much else isn't working. I noted details abotu acts_as_authenticated adn Gruff in the README.