1 # Selectricity: Voting Machinery for the Masses
2 # Copyright (C) 2007, 2008 Benjamin Mako Hill <mako@atdot.cc>
3 # Copyright (C) 2007 Massachusetts Institute of Technology
5 # This program is free software. Please see the COPYING file for
8 class FrontController < ApplicationController
10 require_dependency "user"
11 require_dependency "election"
12 require_dependency "account"
15 @quickvotes = QuickVote.find(:all).sort {|a,b| b.startdate <=> a.startdate}[0..1]
16 # if the person claims they are logged in
19 # check to see that we actually have record of them
20 if User.exists?(session[:user])
21 username = User.find(session[:user]).login
22 # if we have record of them, grab the list of their elections
23 session[:user] = User.find(session[:user])
24 @current_elections = session[:user].elections.sort do |a,b|
25 b.enddate <=> a.enddate
28 # if we have no record of them, set the user back to
29 # nothing and start again