Description:
fixed problem description refresh bug
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r259:fd4ff20f8070 - - 3 files changed: 23 inserted, 9 deleted
@@ -0,0 +1,17 | |||
|
1 | + <div class="problem-bar" id="problem-bar-<%= problem.id %>"> | |
|
2 | + <% if @page_reload_when_view_problem %> | |
|
3 | + <a href="<%= url_for :action => 'list', :id => problem.id %>"> | |
|
4 | + <% else %> | |
|
5 | + <a href="#" | |
|
6 | + onclick="$$('.problem-panel').each(function(elt) {elt.hide();}); $('problem-panel-<%= problem.id %>').show(); $('problem-panel-filler').hide(); return false;"> | |
|
7 | + <% end %> | |
|
8 | + <span class="problem-title"> | |
|
9 | + <%= problem.full_name %> | |
|
10 | + <% if @prob_submissions[problem_title_counter][:count] > 0 %> | |
|
11 | + [<%= @prob_submissions[problem_title_counter][:count] %> trials(s)] | |
|
12 | + <% else %> | |
|
13 | + [No trials] | |
|
14 | + <% end %> | |
|
15 | + </span> | |
|
16 | + </a> | |
|
17 | + </div> |
@@ -269,24 +269,25 | |||
|
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 | 279 | def problems |
|
280 | 280 | prepare_list_information |
|
281 | + @page_reload_when_view_problem = true | |
|
281 | 282 | render :partial => 'problem_title', :collection => @problems, :as => :problem |
|
282 | 283 | end |
|
283 | 284 | |
|
284 | 285 | def splash |
|
285 | 286 | render :text => '<div class="notice">Most recent task:</span>' |
|
286 | 287 | end |
|
287 | 288 | |
|
288 | 289 | protected |
|
289 | 290 | |
|
290 | 291 | def prepare_announcements(recent=nil) |
|
291 | 292 | if Configuration.show_tasks_to?(@user) |
|
292 | 293 | @announcements = Announcement.find_published(true) |
@@ -326,25 +327,29 | |||
|
326 | 327 | sub_count = {} |
|
327 | 328 | @user.submission_statuses.each do |status| |
|
328 | 329 | if status.passed |
|
329 | 330 | passed[status.problem_id] = true |
|
330 | 331 | end |
|
331 | 332 | sub_count[status.problem_id] = status.submission_count |
|
332 | 333 | end |
|
333 | 334 | |
|
334 | 335 | if session.has_key? :current_problem_id |
|
335 | 336 | @current_problem_id = session[:current_problem_id] |
|
336 | 337 | session.delete(:current_problem_id) |
|
337 | 338 | else |
|
338 | - @current_problem_id = nil | |
|
339 | + if params.has_key? :id | |
|
340 | + @current_problem_id = params[:id].to_i | |
|
341 | + else | |
|
342 | + @current_problem_id = nil | |
|
343 | + end | |
|
339 | 344 | end |
|
340 | 345 | |
|
341 | 346 | @problems = all_problems.reject { |problem| passed.has_key? problem.id } |
|
342 | 347 | |
|
343 | 348 | prepare_timeout_information(@problems) |
|
344 | 349 | |
|
345 | 350 | @prob_submissions = Array.new |
|
346 | 351 | @problems.each do |p| |
|
347 | 352 | if sub_count.has_key? p.id |
|
348 | 353 | @prob_submissions << { :count => sub_count[p.id] } |
|
349 | 354 | else |
|
350 | 355 | @prob_submissions << { :count => 0 } |
deleted file |
You need to be logged in to leave comments.
Login now