Description:
merge max score from branch algo
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r411:05396b121058 - - 9 files changed: 124 inserted, 8 deleted
@@ -0,0 +1,18 | |||||
|
|
1 | + | ||
|
|
2 | + = form_tag({action: :user_stat_max }) do | ||
|
|
3 | + .submitbox | ||
|
|
4 | + %table | ||
|
|
5 | + %tr | ||
|
|
6 | + %td{colspan: 6, style: 'font-weight: bold'} Query maximum score in submission range | ||
|
|
7 | + %tr | ||
|
|
8 | + %td{style: 'width: 120px; font-weight: bold'} Submission ID: | ||
|
|
9 | + %td{align: 'right'} From date: | ||
|
|
10 | + %td= text_field_tag 'start_date', params[:start_date] | ||
|
|
11 | + %td Time: | ||
|
|
12 | + %td= text_field_tag 'start_time', params[:start_time], style: 'width:40px' | ||
|
|
13 | + %td= submit_tag 'query' | ||
|
|
14 | + %tr | ||
|
|
15 | + %td | ||
|
|
16 | + %td{colspan: 5} Leave blank date and/or time for no condition | ||
|
|
17 | + %br/ | ||
|
|
18 | + |
@@ -0,0 +1,18 | |||||
|
|
1 | + | ||
|
|
2 | + | ||
|
|
3 | + = form_tag({action: :user_stat_max }) do | ||
|
|
4 | + .submitbox | ||
|
|
5 | + %table | ||
|
|
6 | + %tr | ||
|
|
7 | + %td{colspan: 6, style: 'font-weight: bold'} Query maximum score in submission range | ||
|
|
8 | + %tr | ||
|
|
9 | + %td{style: 'width: 120px; font-weight: bold'} Submission ID: | ||
|
|
10 | + %td{align: 'right'} From: | ||
|
|
11 | + %td= text_field_tag 'since_id', params[:since_id], style: 'width:40px' | ||
|
|
12 | + %td To: | ||
|
|
13 | + %td= text_field_tag 'until_id', params[:until_id], style: 'width:40px' | ||
|
|
14 | + %td= submit_tag 'query' | ||
|
|
15 | + %tr | ||
|
|
16 | + %td | ||
|
|
17 | + %td{colspan: 5} Leave blank for uncondition | ||
|
|
18 | + |
@@ -0,0 +1,44 | |||||
|
|
1 | + %h1 User grading results | ||
|
|
2 | + %h2 Show max scores in submission range | ||
|
|
3 | + | ||
|
|
4 | + - if @problem and @problem.errors | ||
|
|
5 | + =error_messages_for 'problem' | ||
|
|
6 | + | ||
|
|
7 | + = render partial: 'submission_range' | ||
|
|
8 | + | ||
|
|
9 | + - if @log | ||
|
|
10 | + %h3 Import log | ||
|
|
11 | + %pre.import-log | ||
|
|
12 | + = @log | ||
|
|
13 | + | ||
|
|
14 | + %p= link_to '[Show only latest submissions]', controller: :user_admin, action: :user_stat | ||
|
|
15 | + | ||
|
|
16 | + %table.info | ||
|
|
17 | + %thead | ||
|
|
18 | + %tr.info-head | ||
|
|
19 | + %th User | ||
|
|
20 | + %th Name | ||
|
|
21 | + %th Activated? | ||
|
|
22 | + %th Logged in | ||
|
|
23 | + %th Contest(s) | ||
|
|
24 | + - @problems.each do |p| | ||
|
|
25 | + %th= p.name | ||
|
|
26 | + %th Total | ||
|
|
27 | + %th Passed | ||
|
|
28 | + %tbody | ||
|
|
29 | + - @scorearray.each do |sc| | ||
|
|
30 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
31 | + - total,num_passed = 0,0 | ||
|
|
32 | + - sc.each_index do |i| | ||
|
|
33 | + - if i == 0 | ||
|
|
34 | + %td= sc[i].login | ||
|
|
35 | + %td= sc[i].full_name | ||
|
|
36 | + %td= sc[i].activated | ||
|
|
37 | + %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' | ||
|
|
38 | + %td= sc[i].contests.collect {|c| c.name}.join(', ') | ||
|
|
39 | + - else | ||
|
|
40 | + %td= sc[i][0] | ||
|
|
41 | + - total += sc[i][0] | ||
|
|
42 | + - num_passed += 1 if sc[i][1] | ||
|
|
43 | + %td= total | ||
|
|
44 | + %td= num_passed |
@@ -129,12 +129,33 | |||||
|
129 | ustat = Array.new |
|
129 | ustat = Array.new |
|
130 | ustat[0] = u |
|
130 | ustat[0] = u |
|
131 | @problems.each do |p| |
|
131 | @problems.each do |p| |
|
132 |
- |
|
132 | + sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
133 |
- |
|
133 | + if (sub!=nil) and (sub.points!=nil) |
|
134 |
- |
|
134 | + ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
135 | - else |
|
135 | + else |
|
136 |
- |
|
136 | + ustat << [0,false] |
|
137 | - end |
|
137 | + end |
|
|
138 | + end | ||
|
|
139 | + @scorearray << ustat | ||
|
|
140 | + end | ||
|
|
141 | + end | ||
|
|
142 | + | ||
|
|
143 | + def user_stat_max | ||
|
|
144 | + @problems = Problem.find_available_problems | ||
|
|
145 | + @users = User.find(:all, :include => [:contests, :contest_stat]) | ||
|
|
146 | + @scorearray = Array.new | ||
|
|
147 | + #set up range from param | ||
|
|
148 | + since_id = params.fetch(:since_id, 0).to_i | ||
|
|
149 | + until_id = params.fetch(:until_id, 0).to_i | ||
|
|
150 | + @users.each do |u| | ||
|
|
151 | + ustat = Array.new | ||
|
|
152 | + ustat[0] = u | ||
|
|
153 | + @problems.each do |p| | ||
|
|
154 | + max_points = 0 | ||
|
|
155 | + Submission.find_in_range_by_user_and_problem(u.id,p.id,since_id,until_id).each do |sub| | ||
|
|
156 | + max_points = sub.points if sub and sub.points and (sub.points > max_points) | ||
|
|
157 | + end | ||
|
|
158 | + ustat << [(max_points.to_f*100/p.full_score).round, (max_points>=p.full_score)] | ||
|
138 | end |
|
159 | end |
|
139 | @scorearray << ustat |
|
160 | @scorearray << ustat |
|
140 | end |
|
161 | end |
@@ -13,6 +13,7 | |||||
|
13 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
13 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
14 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
14 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
15 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
15 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
|
16 | + append_to menu_items, '[Report]', 'report', 'login_stat' | ||
|
16 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
17 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
17 | append_to menu_items, '[Contests]', 'contest_management', 'index' |
|
18 | append_to menu_items, '[Contests]', 'contest_management', 'index' |
|
18 | append_to menu_items, '[Sites]', 'sites', 'index' |
|
19 | append_to menu_items, '[Sites]', 'sites', 'index' |
@@ -34,6 +34,13 | |||||
|
34 | "ORDER BY user_id") |
|
34 | "ORDER BY user_id") |
|
35 | end |
|
35 | end |
|
36 |
|
36 | ||
|
|
37 | + def self.find_in_range_by_user_and_problem(user_id, problem_id,since_id,until_id) | ||
|
|
38 | + records = Submission.where(problem_id: problem_id,user_id: user_id) | ||
|
|
39 | + records = records.where('id >= ?',since_id) if since_id > 0 | ||
|
|
40 | + records = records.where('id <= ?',until_id) if until_id > 0 | ||
|
|
41 | + records.all | ||
|
|
42 | + end | ||
|
|
43 | + | ||
|
37 | def self.find_last_for_all_available_problems(user_id) |
|
44 | def self.find_last_for_all_available_problems(user_id) |
|
38 | submissions = Array.new |
|
45 | submissions = Array.new |
|
39 | problems = Problem.find_available_problems |
|
46 | problems = Problem.find_available_problems |
@@ -7,6 +7,8 | |||||
|
7 | = link_to '[Submission]', :action => 'submit_stat' |
|
7 | = link_to '[Submission]', :action => 'submit_stat' |
|
8 | = link_to '[Login]', :action => 'login_stat' |
|
8 | = link_to '[Login]', :action => 'login_stat' |
|
9 |
|
9 | ||
|
|
10 | + =render partial: 'date_range' | ||
|
|
11 | + | ||
|
10 | %table.info |
|
12 | %table.info |
|
11 | %thead |
|
13 | %thead |
|
12 | %tr.info-head |
|
14 | %tr.info-head |
@@ -1,4 +1,9 | |||||
|
1 | <h1>User grading results</h1> |
|
1 | <h1>User grading results</h1> |
|
|
2 | + <h2>Show scores from latest submission</h2> | ||
|
|
3 | + | ||
|
|
4 | + <%= render 'submission_range' %> | ||
|
|
5 | + | ||
|
|
6 | + <p>Latest scores</p> | ||
|
2 |
|
7 | ||
|
3 | <table class="info"> |
|
8 | <table class="info"> |
|
4 | <tr class="info-head"> |
|
9 | <tr class="info-head"> |
@@ -1,13 +1,13 | |||||
|
1 | CafeGrader::Application.routes.draw do |
|
1 | CafeGrader::Application.routes.draw do |
|
2 | get "report/login" |
|
2 | get "report/login" |
|
3 |
|
3 | ||
|
4 | - get "logins/list" |
|
||
|
5 | - |
|
||
|
6 | resources :contests |
|
4 | resources :contests |
|
7 |
|
5 | ||
|
8 | resources :announcements |
|
6 | resources :announcements |
|
9 | resources :sites |
|
7 | resources :sites |
|
10 |
|
8 | ||
|
|
9 | + resources :problems, only: [:show] | ||
|
|
10 | + | ||
|
11 | # The priority is based upon order of creation: |
|
11 | # The priority is based upon order of creation: |
|
12 | # first created -> highest priority. |
|
12 | # first created -> highest priority. |
|
13 |
|
13 |
You need to be logged in to leave comments.
Login now