]> projects.mako.cc - selectricity/commitdiff
Disallow identical candidates to be added to a quickvote. Differently cased identical...
authorJohn Dong <jdong@mit.edu>
Thu, 16 Aug 2007 19:45:16 +0000 (15:45 -0400)
committerJohn Dong <jdong@mit.edu>
Thu, 16 Aug 2007 19:45:16 +0000 (15:45 -0400)
app/controllers/quickvote_controller.rb

index 2847df91890d0ffd9212b1cee8c5281a9d1117f6..a365171e0a57bcd6abaaf746749ea404bd00b43f 100644 (file)
@@ -37,7 +37,7 @@ class QuickvoteController < ApplicationController
     candidate_name = CGI.escapeHTML(params[:ajax][:newcandidate])
     unless candidate_name.strip.empty?
       if flash.has_key?(:candlist) and flash[:candlist].instance_of?(Array) 
     candidate_name = CGI.escapeHTML(params[:ajax][:newcandidate])
     unless candidate_name.strip.empty?
       if flash.has_key?(:candlist) and flash[:candlist].instance_of?(Array) 
-        flash[:candlist] << candidate_name
+        flash[:candlist] << candidate_name unless flash[:candlist].index(candidate_name)
      else
        flash[:candlist] = [ candidate_name ]
       end
      else
        flash[:candlist] = [ candidate_name ]
       end

Benjamin Mako Hill || Want to submit a patch?