Description:
- fix syntax error
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r599:14a14eb28fed - - 1 file changed: 1 inserted, 0 deleted

@@ -455,30 +455,31
455 protected
455 protected
456
456
457 def calculate_max_score(problems, users,since_id,until_id, get_last_score = false)
457 def calculate_max_score(problems, users,since_id,until_id, get_last_score = false)
458 scorearray = Array.new
458 scorearray = Array.new
459 users.each do |u|
459 users.each do |u|
460 ustat = Array.new
460 ustat = Array.new
461 ustat[0] = u
461 ustat[0] = u
462 problems.each do |p|
462 problems.each do |p|
463 unless get_last_score
463 unless get_last_score
464 #get max score
464 #get max score
465 max_points = 0
465 max_points = 0
466 Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub|
466 Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub|
467 max_points = sub.points if sub and sub.points and (sub.points > max_points)
467 max_points = sub.points if sub and sub.points and (sub.points > max_points)
468 end
468 end
469 ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)]
469 ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)]
470 else
470 else
471 #get latest score
471 #get latest score
472 sub = Submission.find_last_by_user_and_problem(u.id,p.id)
472 sub = Submission.find_last_by_user_and_problem(u.id,p.id)
473 if (sub!=nil) and (sub.points!=nil) and p and p.full_score
473 if (sub!=nil) and (sub.points!=nil) and p and p.full_score
474 ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)]
474 ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)]
475 else
475 else
476 ustat << [0,false]
476 ustat << [0,false]
477 end
477 end
478 end
478 end
479 + end
479 scorearray << ustat
480 scorearray << ustat
480 end
481 end
481 return scorearray
482 return scorearray
482 end
483 end
483
484
484 end
485 end
You need to be logged in to leave comments. Login now