C0 code coverage information
Generated on Thu Jun 07 11:33:59 -0400 2007 with rcov 0.8.0
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 class SchoolsController < ApplicationController
2 layout "tournament"
3 before_filter :admin_required, :except => ["index","list"]
4 before_filter :tournament_required
5 def index
6 redirect_to :action => "list"
7 end
8
9 def create
10 fix_number_of_teams
11 @school = @tournament.schools.create(params[:school])
12 nteams = params[:teams]
13 @school.create_teams(nteams)
14 @school.save!
15 flash[:notice] = "Registered #{@school.name}: #{@school.teams.size} teams"
16 redirect_to :action => "list"
17 rescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid
18 flash[:errors] = @school.errors.full_messages
19 flash[:notice] = "School not saved"
20 redirect_to :back
21 end
22
23 def add
24 end
25
26 def list
27 @schools = @tournament.schools.find :all, :order => 'name asc'
28 end
29
30 def view
31 @school = @tournament.schools.find params[:id]
32 @config = config
33 end
34
35 def invoices
36 @schools = @tournament.schools.find :all, :order => "name"
37 @config = config
38 end
39
40 def emails
41 @title = "Emails"
42 @header = "contact coaches"
43 if params[:q] == "y"
44 @emails = @tournament.schools.find(:all).select{|s| s.questions > 0}.map{|s|s.email}
45 else
46 @emails = @tournament.schools.find(:all).map{|s|s.email}
47 end
48 end
49
50 def add_team
51 if request.post?
52 @tournament.schools.find(params[:id]).add_team
53 redirect_to :back
54 else
55 redirect_to "/schools/list"
56 end
57 end
58
59 def drop_team
60 if request.delete?
61 @tournament.schools.find(params[:id]).drop_team
62 redirect_to :back
63 else
64 redirect_to "/schools/list"
65 end
66 end
67
68 def drop_school
69 if request.delete?
70 @tournament.schools.find(params[:id]).destroy
71 redirect_to :action => "list"
72 else
73 redirect_to :back
74 end
75 end
76 private
77 def access_denied
78 flash[:errors] = "Administrative rights required for '#{params[:action]}'"
79 redirect_to :action => "list"
80 end
81
82 def fix_number_of_teams
83 nteams = params[:teams].to_i
84 if nteams <= 0
85 nteams = 1
86 elsif nteams > 26
87 nteams = 26
88 end
89 params[:teams] = nteams
90 end
91 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.