Description:
Merge pull request #11 from wytesk133/master
Various fixes
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r372:0688baeb3e31 - - 5 files changed: 14 inserted, 11 deleted
@@ -16,35 +16,35 | |||
|
16 | 16 | UserContestStat.find(:all).each do |stat| |
|
17 | 17 | @start_times[stat.user_id] = stat.started_at |
|
18 | 18 | end |
|
19 | 19 | end |
|
20 | 20 | |
|
21 | 21 | def clear_stat |
|
22 | 22 | user = User.find(params[:id]) |
|
23 | 23 | if user.contest_stat!=nil |
|
24 | 24 | user.contest_stat.destroy |
|
25 | 25 | end |
|
26 | 26 | redirect_to :action => 'user_stat' |
|
27 | 27 | end |
|
28 | 28 | |
|
29 | 29 | def clear_all_stat |
|
30 | 30 | if not GraderConfiguration.indv_contest_mode? |
|
31 | 31 | redirect_to :action => 'index' and return |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | UserContestStat.delete_all() |
|
35 | 35 | flash[:notice] = 'All start time statistic cleared.' |
|
36 | 36 | redirect_to :action => 'index' |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 39 | def change_contest_mode |
|
40 | - if ['standard', 'contest', 'indv-contest'].include? params[:id] | |
|
40 | + if ['standard', 'contest', 'indv-contest', 'analysis'].include? params[:id] | |
|
41 | 41 | config = GraderConfiguration.find_by_key('system.mode') |
|
42 | 42 | config.value = params[:id] |
|
43 | 43 | config.save |
|
44 | 44 | else |
|
45 | 45 | flash[:notice] = 'Wrong contest mode value' |
|
46 | 46 | end |
|
47 | 47 | redirect_to :action => 'index' |
|
48 | 48 | end |
|
49 | 49 | |
|
50 | 50 | end |
@@ -171,49 +171,49 | |||
|
171 | 171 | else |
|
172 | 172 | send_file out_filename, :stream => false, :filename => "output-#{case_num}.txt", :type => "text/plain" |
|
173 | 173 | end |
|
174 | 174 | end |
|
175 | 175 | |
|
176 | 176 | def error |
|
177 | 177 | @user = User.find(session[:user_id]) |
|
178 | 178 | end |
|
179 | 179 | |
|
180 | 180 | # announcement refreshing and hiding methods |
|
181 | 181 | |
|
182 | 182 | def announcements |
|
183 | 183 | if params.has_key? 'recent' |
|
184 | 184 | prepare_announcements(params[:recent]) |
|
185 | 185 | else |
|
186 | 186 | prepare_announcements |
|
187 | 187 | end |
|
188 | 188 | render(:partial => 'announcement', |
|
189 | 189 | :collection => @announcements, |
|
190 | 190 | :locals => {:announcement_effect => true}) |
|
191 | 191 | end |
|
192 | 192 | |
|
193 | 193 | def confirm_contest_start |
|
194 | 194 | user = User.find(session[:user_id]) |
|
195 |
- if request.method == |
|
|
195 | + if request.method == 'POST' | |
|
196 | 196 | user.update_start_time |
|
197 | 197 | redirect_to :action => 'list' |
|
198 | 198 | else |
|
199 | 199 | @contests = user.contests |
|
200 | 200 | @user = user |
|
201 | 201 | end |
|
202 | 202 | end |
|
203 | 203 | |
|
204 | 204 | protected |
|
205 | 205 | |
|
206 | 206 | def prepare_announcements(recent=nil) |
|
207 | 207 | if GraderConfiguration.show_tasks_to?(@user) |
|
208 | 208 | @announcements = Announcement.find_published(true) |
|
209 | 209 | else |
|
210 | 210 | @announcements = Announcement.find_published |
|
211 | 211 | end |
|
212 | 212 | if recent!=nil |
|
213 | 213 | recent_id = recent.to_i |
|
214 | 214 | @announcements = @announcements.find_all { |a| a.id > recent_id } |
|
215 | 215 | end |
|
216 | 216 | end |
|
217 | 217 | |
|
218 | 218 | def prepare_list_information |
|
219 | 219 | @user = User.find(session[:user_id]) |
@@ -1,31 +1,34 | |||
|
1 | 1 | %h1 Contest management |
|
2 | 2 | |
|
3 | 3 | .infobox |
|
4 | 4 | |
|
5 | 5 | - if @num_contests>1 |
|
6 | 6 | %b Multiple contests: |
|
7 | 7 | = "There are #{@num_contests} contests running." |
|
8 | 8 | - else |
|
9 | 9 | %b Single contest: |
|
10 | 10 | =raw "[#{link_to 'Add/remove contests', :controller => 'contests', :action => 'index'}]" |
|
11 | 11 | |
|
12 | 12 | .infobox |
|
13 | 13 | %b Web interface mode: |
|
14 | - - if (not GraderConfiguration.contest_mode?) and (not GraderConfiguration.indv_contest_mode?) | |
|
15 | - standard mode | |
|
14 | + - if GraderConfiguration.analysis_mode? | |
|
15 | + Analysis Mode | |
|
16 | + - elsif (not GraderConfiguration.contest_mode?) and (not GraderConfiguration.indv_contest_mode?) | |
|
17 | + Standard Mode | |
|
16 | 18 | - elsif GraderConfiguration.contest_mode? |
|
17 |
- |
|
|
19 | + Normal Contest Mode | |
|
18 | 20 | - else |
|
19 |
- |
|
|
21 | + Individual Contest Mode | |
|
20 | 22 | |
|
21 | 23 | %br/ |
|
22 | 24 | Change mode to: |
|
23 |
- =raw "[#{link_to ' |
|
|
24 |
- =raw "[#{link_to ' |
|
|
25 |
- =raw "[#{link_to ' |
|
|
25 | + =raw "[#{link_to 'Standard', :action => 'change_contest_mode', :id => 'standard'}]" | |
|
26 | + =raw "[#{link_to 'Contest', :action => 'change_contest_mode', :id => 'contest'}]" | |
|
27 | + =raw "[#{link_to 'Individual Contest', :action => 'change_contest_mode', :id => 'indv-contest'}]" | |
|
28 | + =raw "[#{link_to 'Analysis', :action => 'change_contest_mode', :id => 'analysis'}]" | |
|
26 | 29 | |
|
27 | 30 | - if GraderConfiguration.indv_contest_mode? |
|
28 | 31 | = render :partial => 'indv_contest_mode_index' |
|
29 | 32 | |
|
30 | 33 | %br/ |
|
31 | 34 |
@@ -4,37 +4,37 | |||
|
4 | 4 | User: |
|
5 | 5 | = "#{@test_request.user.login}" |
|
6 | 6 | %br/ |
|
7 | 7 | Problem: |
|
8 | 8 | - if @test_request.problem!=nil |
|
9 | 9 | = "#{@test_request.problem.full_name}" |
|
10 | 10 | - else |
|
11 | 11 | = "(n/a)" |
|
12 | 12 | %br/ |
|
13 | 13 | = "Submission: #{@test_request.submission.number}" |
|
14 | 14 | = link_to '[view submission]', :action => 'submission', :id => @test_request.submission.id |
|
15 | 15 | %br/ |
|
16 | 16 | = "Test submitted at: #{format_short_time(@test_request.submitted_at)}" |
|
17 | 17 | %br/ |
|
18 | 18 | = "Execution time: #{@test_request.running_time} s." |
|
19 | 19 | %br/ |
|
20 | 20 | = "Memory usage: #{@test_request.memory_usage}kb" |
|
21 | 21 | %br/ |
|
22 | 22 | %b= @test_request.exit_status |
|
23 | 23 | %br/ |
|
24 | 24 | |
|
25 | 25 | - if @test_request.compiler_message!=nil and @test_request.compiler_message!='' |
|
26 | 26 | %b Compiler Message |
|
27 | 27 | %div{:style => "border: 1px solid black; background: lightgrey"} |
|
28 | - = simple_format(truncate((@test_request.compiler_message or ''),200)) | |
|
28 | + = simple_format(truncate((@test_request.compiler_message or ''), :length => 200)) | |
|
29 | 29 | |
|
30 | 30 | %b Input (first 2kb) |
|
31 | 31 | %div{:style => "border: 1px solid black; background: lightgrey"} |
|
32 | 32 | - if @test_request.input_file_name!=nil |
|
33 | 33 | = simple_format(read_textfile(@test_request.input_file_name,2048)) |
|
34 | 34 | |
|
35 | 35 | %b Output (first 2kb) |
|
36 | 36 | %div{:style => "border: 1px solid black; background: lightgrey"} |
|
37 | 37 | - if @test_request.output_file_name!=nil |
|
38 | 38 | = simple_format(read_textfile(@test_request.output_file_name,2048)) |
|
39 | 39 | - else |
|
40 | 40 | (no output) |
@@ -1,16 +1,16 | |||
|
1 | 1 | = user_title_bar(@user) |
|
2 | 2 | |
|
3 | 3 | .announcementbox |
|
4 | 4 | %span{:class => 'title'} |
|
5 | 5 | =t 'main.confirm_contest_start.box_title' |
|
6 | 6 | .announcement |
|
7 | 7 | %center |
|
8 | 8 | =t 'main.confirm_contest_start.contest_list' |
|
9 | 9 | - @contests.each do |contest| |
|
10 | 10 | = contest.title |
|
11 | 11 | %br |
|
12 | 12 | |
|
13 | 13 | =t 'main.confirm_contest_start.timer_starts_after_click' |
|
14 | 14 | |
|
15 |
- = form_tag :action => 'confirm_contest_start' |
|
|
15 | + = form_tag :action => 'confirm_contest_start' do | |
|
16 | 16 | = submit_tag t('main.confirm_contest_start.start_button'), :confirm => t('main.confirm_contest_start.start_button_confirm') |
You need to be logged in to leave comments.
Login now