Description:
fix display bugs in corrent score
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r782:97cd56a5f1d8 - - 3 files changed: 5 inserted, 4 deleted

@@ -456,24 +456,25
456 p = [@st,@since_time,@until_time] + @sid + [@since_time,@until_time] + @sid
456 p = [@st,@since_time,@until_time] + @sid + [@since_time,@until_time] + @sid
457 @logs = Submission.joins(:problem).find_by_sql(p)
457 @logs = Submission.joins(:problem).find_by_sql(p)
458
458
459
459
460
460
461
461
462
462
463 end
463 end
464
464
465 protected
465 protected
466
466
467 def calculate_max_score(problems, users,since_id,until_id, get_last_score = false)
467 def calculate_max_score(problems, users,since_id,until_id, get_last_score = false)
468 + #score[i] = user #i's user stat where i is the index (not id)
468 scorearray = Array.new
469 scorearray = Array.new
469 users.each do |u|
470 users.each do |u|
470 ustat = Array.new
471 ustat = Array.new
471 ustat[0] = u
472 ustat[0] = u
472 problems.each do |p|
473 problems.each do |p|
473 unless get_last_score
474 unless get_last_score
474 #get max score
475 #get max score
475 max_points = 0
476 max_points = 0
476 Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub|
477 Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub|
477 max_points = sub.points if sub and sub.points and (sub.points > max_points)
478 max_points = sub.points if sub and sub.points and (sub.points > max_points)
478 end
479 end
479 ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)]
480 ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)]
@@ -3,27 +3,27
3 %tr
3 %tr
4 %th Login
4 %th Login
5 %th Name
5 %th Name
6 / %th Activated?
6 / %th Activated?
7 / %th Logged_in
7 / %th Logged_in
8 / %th Contest(s)
8 / %th Contest(s)
9 %th Remark
9 %th Remark
10 - @problems.each do |p|
10 - @problems.each do |p|
11 %th.text-right= p.name.gsub('_',' ')
11 %th.text-right= p.name.gsub('_',' ')
12 %th.text-right Total
12 %th.text-right Total
13 %th.text-right Passed
13 %th.text-right Passed
14 %tbody
14 %tbody
15 - - sum = Array.new(@scorearray[0].count,0)
15 + - sum = Array.new(@problems.count,0)
16 - - nonzero = Array.new(@scorearray[0].count,0)
16 + - nonzero = Array.new(@problems.count,0)
17 - - full = Array.new(@scorearray[0].count,0)
17 + - full = Array.new(@problems.count,0)
18 - @scorearray.each do |sc|
18 - @scorearray.each do |sc|
19 %tr
19 %tr
20 - total,num_passed = 0,0
20 - total,num_passed = 0,0
21 - sc.each_index do |i|
21 - sc.each_index do |i|
22 - if i == 0
22 - if i == 0
23 %td= link_to sc[i].login, stat_user_path(sc[i])
23 %td= link_to sc[i].login, stat_user_path(sc[i])
24 %td= sc[i].full_name
24 %td= sc[i].full_name
25 / %td= sc[i].activated
25 / %td= sc[i].activated
26 / %td= sc[i].try(:contest_stat).try(:started_at) ? 'yes' : 'no'
26 / %td= sc[i].try(:contest_stat).try(:started_at) ? 'yes' : 'no'
27 / %td= sc[i].contests.collect {|c| c.name}.join(', ')
27 / %td= sc[i].contests.collect {|c| c.name}.join(', ')
28 %td= sc[i].remark
28 %td= sc[i].remark
29 - else
29 - else
@@ -1,11 +1,11
1 .container-fluid
1 .container-fluid
2 %h1 Current Score
2 %h1 Current Score
3 = form_tag current_score_report_path, method: 'get' do
3 = form_tag current_score_report_path, method: 'get' do
4 Show only users from this group
4 Show only users from this group
5 - = select_tag "group_id", options_from_collection_for_select( Group.all, 'id','name',params[:group_name]), id: 'group_name',class: 'select2'
5 + = select_tag "group_id", options_from_collection_for_select( Group.all, 'id','name',params[:group_id]), id: 'group_name',class: 'select2', style: 'width: 20em';
6 = submit_tag 'Apply',class: 'btn btn-default'
6 = submit_tag 'Apply',class: 'btn btn-default'
7
7
8 %br
8 %br
9
9
10
10
11 = render "score_table"
11 = render "score_table"
You need to be logged in to leave comments. Login now