Description:
[web] fixed test page crashes when problem is deleted
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@193 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r101:4a05c0a30468 - - 5 files changed: 28 inserted, 8 deleted
@@ -88,21 +88,30 | |||
|
88 | 88 | redirect_to :action => 'list' |
|
89 | 89 | end |
|
90 | 90 | |
|
91 | 91 | def turn_all_off |
|
92 | 92 | Problem.find(:all, |
|
93 | 93 | :conditions => "available = 1").each do |problem| |
|
94 | 94 | problem.available = false |
|
95 | 95 | problem.save |
|
96 | 96 | end |
|
97 | 97 | redirect_to :action => 'list' |
|
98 | 98 | end |
|
99 | 99 | |
|
100 | + def turn_all_on | |
|
101 | + Problem.find(:all, | |
|
102 | + :conditions => "available = 0").each do |problem| | |
|
103 | + problem.available = true | |
|
104 | + problem.save | |
|
105 | + end | |
|
106 | + redirect_to :action => 'list' | |
|
107 | + end | |
|
108 | + | |
|
100 | 109 | def stat |
|
101 | 110 | @problem = Problem.find(params[:id]) |
|
102 | 111 | if !@problem.available |
|
103 | 112 | redirect_to :controller => 'main', :action => 'list' |
|
104 | 113 | else |
|
105 | 114 | @submissions = Submission.find_all_last_by_problem(params[:id]) |
|
106 | 115 | end |
|
107 | 116 | end |
|
108 | 117 | end |
@@ -1,22 +1,25 | |||
|
1 | 1 | <% content_for :head do %> |
|
2 | 2 | <%= stylesheet_link_tag 'scaffold' %> |
|
3 | 3 | <%= stylesheet_link_tag 'problems' %> |
|
4 | 4 | <%= javascript_include_tag :defaults %> |
|
5 | 5 | <% end %> |
|
6 | 6 | |
|
7 | 7 | <h1>Listing problems</h1> |
|
8 | 8 | |
|
9 | + <p> | |
|
9 | 10 | <%= link_to 'New problem', :action => 'new' %> |
|
10 |
- <%= link_to 'Turn off all problems', :action => 'turn_all_off' %> |
|
|
11 | + <%= link_to 'Turn off all problems', :action => 'turn_all_off' %> | |
|
12 | + <%= link_to 'Turn on all problems', :action => 'turn_all_on' %> | |
|
13 | + </p> | |
|
11 | 14 | |
|
12 | 15 | <table> |
|
13 | 16 | <tr> |
|
14 | 17 | <th>Name</th> |
|
15 | 18 | <th>Full name</th> |
|
16 | 19 | <th>Full score</th> |
|
17 | 20 | <th>Date added</th> |
|
18 | 21 | <th>Avail?</th> |
|
19 | 22 | <th>Test?</th> |
|
20 | 23 | </tr> |
|
21 | 24 | |
|
22 | 25 | <% for problem in @problems %> |
@@ -1,16 +1,20 | |||
|
1 | 1 | %tr{:class => (test_request_counter%2==0) ? "info-even" : "info-odd"} |
|
2 | 2 | %td{:align => "center"} |
|
3 | 3 | = format_short_time(test_request.submitted_at) |
|
4 | - %td= test_request.problem.full_name | |
|
4 | + %td | |
|
5 | + - if test_request.problem!=nil | |
|
6 | + = test_request.problem.full_name | |
|
7 | + - else | |
|
8 | + (n/a) | |
|
5 | 9 | %td{:align => "center"} |
|
6 | 10 | = test_request.submission.number |
|
7 | 11 | %td{:align => "center"} |
|
8 | 12 | = test_request.status_str |
|
9 | 13 | %td{:align => "center"} |
|
10 | 14 | - if test_request.output_file_name!=nil |
|
11 | 15 | = link_to '[download]', :action => 'read', :id => test_request.id |
|
12 | 16 | %td{:align => "center"} |
|
13 | 17 | - if test_request.compiler_message!=nil and test_request.compiler_message!='' |
|
14 | 18 | = "yes" |
|
15 | 19 | - else |
|
16 | 20 | = "no" |
@@ -1,16 +1,20 | |||
|
1 | 1 | = user_title_bar(@user) |
|
2 | 2 | |
|
3 | 3 | %div{:style => "text-align: center; font-size: 12px"} |
|
4 | - = "Problem: #{@test_request.problem.full_name}" | |
|
4 | + Problem: | |
|
5 | + - if @test_request.problem!=nil | |
|
6 | + = "#{@test_request.problem.full_name}" | |
|
7 | + - else | |
|
8 | + = "(n/a)" | |
|
5 | 9 | %br/ |
|
6 | 10 | = "Submission: #{@test_request.submission.number}" |
|
7 | 11 | %br/ |
|
8 | 12 | = "Test submitted at: #{format_short_time(@test_request.submitted_at)}" |
|
9 | 13 | %br/ |
|
10 | 14 | = "Execution time: #{@test_request.running_time} s." |
|
11 | 15 | %br/ |
|
12 | 16 | = "Memory usage: #{@test_request.memory_usage}kb" |
|
13 | 17 | %br/ |
|
14 | 18 | %b= @test_request.exit_status |
|
15 | 19 | %br/ |
|
16 | 20 |
@@ -156,38 +156,38 | |||
|
156 | 156 | padding-left: 20px; |
|
157 | 157 | background: #feeefe; |
|
158 | 158 | } |
|
159 | 159 | |
|
160 | 160 | /********************** |
|
161 | 161 | [Announcement] |
|
162 | 162 | ***********************/ |
|
163 | 163 | |
|
164 | 164 | div.announcementbox { |
|
165 | 165 | margin-top: 10px; |
|
166 | 166 | margin-bottom: 10px; |
|
167 | 167 | background: green; |
|
168 |
- padding: |
|
|
168 | + padding: 1px; | |
|
169 | 169 | } |
|
170 | 170 | |
|
171 | 171 | div.announcementbox span.title { |
|
172 | 172 | font-weight: bold; |
|
173 | 173 | color: white; |
|
174 | 174 | padding-left: 10px; |
|
175 | 175 | } |
|
176 | 176 | |
|
177 | 177 | div.announcement { |
|
178 | 178 | margin: 2px; |
|
179 | 179 | background: white; |
|
180 |
- padding: |
|
|
180 | + padding: 1px; | |
|
181 | 181 | padding-left: 10px; |
|
182 | 182 | padding-right: 10px; |
|
183 | 183 | } |
|
184 | 184 | |
|
185 | 185 | div.announcement p { |
|
186 |
- font-size: 1 |
|
|
186 | + font-size: 12px; | |
|
187 | 187 | } |
|
188 | 188 | |
|
189 | 189 | div.pub-info, div.pub-info p { |
|
190 | 190 | text-align: right; |
|
191 | 191 | font-style: italic; |
|
192 |
- font-size: |
|
|
193 | - } No newline at end of file | |
|
192 | + font-size: 9px; | |
|
193 | + } |
You need to be logged in to leave comments.
Login now