Description:
remove lingering debug info
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r786:4e030454953c - - 3 files changed: 0 inserted, 6 deleted

@@ -109,60 +109,59
109 109 unless GraderConfiguration[MULTIPLE_IP_LOGIN_CONF_KEY]
110 110 user = User.find(session[:user_id])
111 111 if (!user.admin? && user.last_ip && user.last_ip != request.remote_ip)
112 112 flash[:notice] = "You cannot use the system from #{request.remote_ip}. Your last ip is #{user.last_ip}"
113 113 redirect_to :controller => 'main', :action => 'login'
114 114 return false
115 115 end
116 116 unless user.last_ip
117 117 user.last_ip = request.remote_ip
118 118 user.save
119 119 end
120 120 end
121 121 return true
122 122 end
123 123
124 124 def authorization
125 125 return false unless check_valid_login
126 126 user = User.find(session[:user_id])
127 127 unless user.roles.detect { |role|
128 128 role.rights.detect{ |right|
129 129 right.controller == self.class.controller_name and
130 130 (right.action == 'all' || right.action == action_name)
131 131 }
132 132 }
133 133 flash[:notice] = 'You are not authorized to view the page you requested'
134 134 #request.env['HTTP_REFERER'] ? (redirect_to :back) : (redirect_to :controller => 'login')
135 135 redirect_to :controller => 'main', :action => 'login'
136 136 return false
137 137 end
138 138 end
139 139
140 140 def verify_time_limit
141 141 return true if session[:user_id]==nil
142 142 user = User.find(session[:user_id], :include => :site)
143 143 return true if user==nil || user.site == nil
144 144 if user.contest_finished?
145 145 flash[:notice] = 'Error: the contest you are participating is over.'
146 146 redirect_to :back
147 147 return false
148 148 end
149 149 return true
150 150 end
151 151
152 152 def is_request_ip_allowed?
153 153 unless GraderConfiguration[WHITELIST_IGNORE_CONF_KEY]
154 154 user_ip = IPAddr.new(request.remote_ip)
155 155
156 156 GraderConfiguration[WHITELIST_IP_CONF_KEY].delete(' ').split(',').each do |ips|
157 - puts "ip is #{ips}, user ip is #{user_ip}"
158 157 allow_ips = IPAddr.new(ips)
159 158 if allow_ips.include?(user_ip)
160 159 return true
161 160 end
162 161 end
163 162 return false
164 163 end
165 164 return true
166 165 end
167 166
168 167 end
@@ -30,86 +30,83
30 30 @submission = Submission.find(params[:id])
31 31
32 32 #log the viewing
33 33 user = User.find(session[:user_id])
34 34 SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin?
35 35
36 36 @task = @submission.task
37 37 end
38 38
39 39 def download
40 40 @submission = Submission.find(params[:id])
41 41 send_data(@submission.source, {:filename => @submission.download_filename, :type => 'text/plain'})
42 42 end
43 43
44 44 def compiler_msg
45 45 @submission = Submission.find(params[:id])
46 46 respond_to do |format|
47 47 format.js
48 48 end
49 49 end
50 50
51 51 #on-site new submission on specific problem
52 52 def direct_edit_problem
53 53 @problem = Problem.find(params[:problem_id])
54 54 unless @current_user.can_view_problem?(@problem)
55 55 unauthorized_redirect
56 56 return
57 57 end
58 58 @source = ''
59 59 if (params[:view_latest])
60 60 sub = Submission.find_last_by_user_and_problem(@current_user.id,@problem.id)
61 61 @source = @submission.source.to_s if @submission and @submission.source
62 62 end
63 63 render 'edit'
64 64 end
65 65
66 66 # GET /submissions/1/edit
67 67 def edit
68 68 @submission = Submission.find(params[:id])
69 69 @source = @submission.source.to_s
70 70 @problem = @submission.problem
71 71 @lang_id = @submission.language.id
72 72 end
73 73
74 74
75 75 def get_latest_submission_status
76 76 @problem = Problem.find(params[:pid])
77 77 @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid])
78 - puts User.find(params[:uid]).login
79 - puts Problem.find(params[:pid]).name
80 - puts 'nil' unless @submission
81 78 respond_to do |format|
82 79 format.js
83 80 end
84 81 end
85 82
86 83 # GET /submissions/:id/rejudge
87 84 def rejudge
88 85 @submission = Submission.find(params[:id])
89 86 @task = @submission.task
90 87 @task.status_inqueue! if @task
91 88 respond_to do |format|
92 89 format.js
93 90 end
94 91 end
95 92
96 93 protected
97 94
98 95 def submission_authorization
99 96 #admin always has privileged
100 97 if @current_user.admin?
101 98 return true
102 99 end
103 100
104 101 sub = Submission.find(params[:id])
105 102 if @current_user.available_problems.include? sub.problem
106 103 return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user
107 104 end
108 105
109 106 #default to NO
110 107 unauthorized_redirect
111 108 return false
112 109 end
113 110
114 111
115 112 end
@@ -1,67 +1,65
1 1 %table.table.sortable.table-striped.table-bordered.table-condensed
2 2 %thead
3 3 %tr
4 4 %th Login
5 5 %th Name
6 6 / %th Activated?
7 7 / %th Logged_in
8 8 / %th Contest(s)
9 9 %th Remark
10 10 - @problems.each do |p|
11 11 %th.text-right= p.name.gsub('_',' ')
12 12 %th.text-right Total
13 13 %th.text-right Passed
14 14 %tbody
15 15 - sum = Array.new(@problems.count+1,0)
16 16 - nonzero = Array.new(@problems.count+1,0)
17 17 - full = Array.new(@problems.count+1,0)
18 - - puts @scorearray
19 - - puts @problems.count
20 18 - @scorearray.each do |sc|
21 19 %tr
22 20 - total,num_passed = 0,0
23 21 - sc.each_index do |i|
24 22 - if i == 0
25 23 %td= link_to sc[i].login, stat_user_path(sc[i])
26 24 %td= sc[i].full_name
27 25 / %td= sc[i].activated
28 26 / %td= sc[i].try(:contest_stat).try(:started_at) ? 'yes' : 'no'
29 27 / %td= sc[i].contests.collect {|c| c.name}.join(', ')
30 28 %td= sc[i].remark
31 29 - else
32 30 %td.text-right= sc[i][0]
33 31 - total += sc[i][0]
34 32 - num_passed += 1 if sc[i][1]
35 33 - sum[i] += sc[i][0]
36 34 - nonzero[i] += 1 if sc[i][0] > 0
37 35 - full[i] += 1 if sc[i][1]
38 36 %td.text-right= total
39 37 %td.text-right= num_passed
40 38 %tfoot
41 39 %tr
42 40 %td Summation
43 41 %td
44 42 %td
45 43 - sum.each.with_index do |s,i|
46 44 - next if i == 0
47 45 %td.text-right= number_with_delimiter(s)
48 46 %td
49 47 %td
50 48 %tr
51 49 %td partial solver
52 50 %td
53 51 %td
54 52 - nonzero.each.with_index do |s,i|
55 53 - next if i == 0
56 54 %td.text-right= number_with_delimiter(s)
57 55 %td
58 56 %td
59 57 %tr
60 58 %td Full solver
61 59 %td
62 60 %td
63 61 - full.each.with_index do |s,i|
64 62 - next if i == 0
65 63 %td.text-right= number_with_delimiter(s)
66 64 %td
67 65 %td
You need to be logged in to leave comments. Login now