Description:
added problem list auto update
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r257:76846842a151 - - 3 files changed: 14 inserted, 2 deleted

@@ -255,48 +255,57
255 255 :points => points)
256 256 submission.save
257 257 recent_assignment.submitted = true
258 258 recent_assignment.save
259 259
260 260 status = user.get_submission_status_for(problem)
261 261 if status == nil
262 262 status = SubmissionStatus.new :user => user, :problem => problem, :submission_count => 0
263 263 end
264 264
265 265 status.submission_count += 1
266 266 status.passed = passed
267 267 status.save
268 268
269 269 if passed
270 270 flash[:notice] = 'Correct solution.'
271 271 user.update_codejom_status
272 272 else
273 273 session[:current_problem_id] = problem.id
274 274 flash[:notice] = 'Incorrect solution.'
275 275 end
276 276 redirect_to :action => 'list'
277 277 end
278 278
279 + def problems
280 + prepare_list_information
281 + render :partial => 'problem_title', :collection => @problems, :as => :problem
282 + end
283 +
284 + def splash
285 + render :text => '<div class="notice">Most recent task:</span>'
286 + end
287 +
279 288 protected
280 289
281 290 def prepare_announcements(recent=nil)
282 291 if Configuration.show_tasks_to?(@user)
283 292 @announcements = Announcement.find_published(true)
284 293 else
285 294 @announcements = Announcement.find_published
286 295 end
287 296 if recent!=nil
288 297 recent_id = recent.to_i
289 298 @announcements = @announcements.find_all { |a| a.id > recent_id }
290 299 end
291 300 end
292 301
293 302 def prepare_timeout_information(problems)
294 303 @submission_timeouts = {}
295 304 problems.each do |problem|
296 305 assignment = @user.get_recent_test_pair_assignment_for(problem)
297 306 if assignment == nil
298 307 timeout = nil
299 308 else
300 309 if (assignment.expired?) or (assignment.submitted)
301 310 timeout = 0
302 311 else
@@ -1,39 +1,42
1 1 - content_for :head do
2 2 = javascript_include_tag :defaults
3 3 = javascript_include_tag 'announcement_refresh.js'
4 4 = javascript_include_tag 'codejom_timeout.js'
5 5
6 6 = user_title_bar(@user)
7 7
8 8 .announcementbox{:style => (@announcements.length==0 ? "display:none" : "")}
9 9 %span{:class => 'title'}
10 10 Announcements
11 11 #announcementbox-body
12 12 = render :partial => 'announcement', :collection => @announcements
13 13
14 14 %hr/
15 15
16 16 - if (Configuration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true)
17 17 %p=t 'main.start_soon'
18 18
19 19 - if Configuration.show_tasks_to?(@user)
20 - .problem-list
20 + .problem-list{:id => 'problem-list'}
21 21 = render :partial => 'problem_title', :collection => @problems, :as => :problem
22 22 .problem-content
23 23 %span{:id => "problem-panel-filler", :style => (@current_problem_id!=nil) ? "display:none" : ""}
24 24 %h2
25 25 Welcome to Code Jom
26 26 %br/
27 27 Choose problems from the list on the right.
28 28 = render :partial => 'problem', :collection => @problems
29 29
30 30 %br{:clear=>'both'}/
31 31 %hr/
32 32
33 33 %script{:type => 'text/javascript'}
34 34 = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';"
35 35 Announcement.registerRefreshEventTimer();
36 36 = render :partial => 'submission_timeouts'
37 37 CodejomTimeout.updateProblemMessages();
38 38 CodejomTimeout.registerRefreshEvent();
39 39
40 + = periodically_call_remote(:url => { :action => 'problems' }, :update => 'problem-list')
41 +
42 +
@@ -314,25 +314,25
314 314 .notice-bar
315 315 margin-top: 3px
316 316 margin-bottom: 3px
317 317 text-align: center
318 318
319 319 span.notice
320 320 color: white
321 321 font-weight: bold
322 322 background: #000070
323 323 padding: 3px 20px 3px 20px
324 324 -moz-border-radius: 2px
325 325 -webkit-border-radius: 5px
326 326 border-radius: 5px
327 327
328 328 table.codejom-problems
329 329 th
330 330 background: #000070
331 331 color: white
332 332 td
333 333 width: 200px
334 334 vertical-align: top
335 335 text-align: center
336 336
337 337 &.random-button
338 - background: lightgrey No newline at end of file
338 + background: lightgrey
You need to be logged in to leave comments. Login now