Description:
- add problem toggle test js reponse (it was forgotten)
- change score report to bootstrap-sortable
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r570:0b74eb4e28fa - - 8 files changed: 77 inserted, 25 deleted
@@ -0,0 +1,2 | |||||
|
|
1 | + = render partial: 'toggle_button', | ||
|
|
2 | + locals: {button_id: "#problem-test-#{@problem.id}",button_on: @problem.test_allowed?} |
@@ -54,15 +54,19 | |||||
|
54 | #add bootstrap |
|
54 | #add bootstrap |
|
55 | gem 'bootstrap-sass', '~> 3.2.0' |
|
55 | gem 'bootstrap-sass', '~> 3.2.0' |
|
56 | gem 'bootstrap-switch-rails' |
|
56 | gem 'bootstrap-switch-rails' |
|
57 | gem 'bootstrap-toggle-rails' |
|
57 | gem 'bootstrap-toggle-rails' |
|
58 | gem 'autoprefixer-rails' |
|
58 | gem 'autoprefixer-rails' |
|
59 |
|
59 | ||
|
|
60 | + #bootstrap sortable | ||
|
|
61 | + gem 'momentjs-rails' | ||
|
|
62 | + gem 'rails_bootstrap_sortable' | ||
|
|
63 | + | ||
|
|
64 | + #ace editor | ||
|
60 | gem 'ace-rails-ap' |
|
65 | gem 'ace-rails-ap' |
|
61 |
|
66 | ||
|
62 | - |
|
||
|
63 | gem 'haml' |
|
67 | gem 'haml' |
|
64 | gem 'haml-rails' |
|
68 | gem 'haml-rails' |
|
65 | gem 'mail' |
|
69 | gem 'mail' |
|
66 | gem 'rdiscount' |
|
70 | gem 'rdiscount' |
|
67 | gem 'test-unit' |
|
71 | gem 'test-unit' |
|
68 | gem 'will_paginate', '~> 3.0.7' |
|
72 | gem 'will_paginate', '~> 3.0.7' |
@@ -87,12 +87,14 | |||||
|
87 | railties (>= 3.1.0) |
|
87 | railties (>= 3.1.0) |
|
88 | json (1.8.2) |
|
88 | json (1.8.2) |
|
89 | mail (2.5.4) |
|
89 | mail (2.5.4) |
|
90 | mime-types (~> 1.16) |
|
90 | mime-types (~> 1.16) |
|
91 | treetop (~> 1.4.8) |
|
91 | treetop (~> 1.4.8) |
|
92 | mime-types (1.25.1) |
|
92 | mime-types (1.25.1) |
|
|
93 | + momentjs-rails (2.11.1) | ||
|
|
94 | + railties (>= 3.1) | ||
|
93 | multi_json (1.10.1) |
|
95 | multi_json (1.10.1) |
|
94 | mysql2 (0.3.20) |
|
96 | mysql2 (0.3.20) |
|
95 | polyglot (0.3.5) |
|
97 | polyglot (0.3.5) |
|
96 | power_assert (0.2.2) |
|
98 | power_assert (0.2.2) |
|
97 | prototype-rails (3.2.1) |
|
99 | prototype-rails (3.2.1) |
|
98 | rails (~> 3.2) |
|
100 | rails (~> 3.2) |
@@ -108,12 +110,14 | |||||
|
108 | actionpack (= 3.2.21) |
|
110 | actionpack (= 3.2.21) |
|
109 | activerecord (= 3.2.21) |
|
111 | activerecord (= 3.2.21) |
|
110 | activeresource (= 3.2.21) |
|
112 | activeresource (= 3.2.21) |
|
111 | activesupport (= 3.2.21) |
|
113 | activesupport (= 3.2.21) |
|
112 | bundler (~> 1.0) |
|
114 | bundler (~> 1.0) |
|
113 | railties (= 3.2.21) |
|
115 | railties (= 3.2.21) |
|
|
116 | + rails_bootstrap_sortable (2.0.0) | ||
|
|
117 | + momentjs-rails (~> 2, >= 2.8.3) | ||
|
114 | railties (3.2.21) |
|
118 | railties (3.2.21) |
|
115 | actionpack (= 3.2.21) |
|
119 | actionpack (= 3.2.21) |
|
116 | activesupport (= 3.2.21) |
|
120 | activesupport (= 3.2.21) |
|
117 | rack-ssl (~> 1.3.2) |
|
121 | rack-ssl (~> 1.3.2) |
|
118 | rake (>= 0.8.7) |
|
122 | rake (>= 0.8.7) |
|
119 | rdoc (~> 3.4) |
|
123 | rdoc (~> 3.4) |
@@ -180,15 +184,17 | |||||
|
180 | in_place_editing |
|
184 | in_place_editing |
|
181 | jquery-rails |
|
185 | jquery-rails |
|
182 | jquery-tablesorter |
|
186 | jquery-tablesorter |
|
183 | jquery-timepicker-addon-rails |
|
187 | jquery-timepicker-addon-rails |
|
184 | jquery-ui-sass-rails |
|
188 | jquery-ui-sass-rails |
|
185 |
|
189 | ||
|
|
190 | + momentjs-rails | ||
|
186 | mysql2 |
|
191 | mysql2 |
|
187 | prototype-rails |
|
192 | prototype-rails |
|
188 | rails (= 3.2.21) |
|
193 | rails (= 3.2.21) |
|
|
194 | + rails_bootstrap_sortable | ||
|
189 | rdiscount |
|
195 | rdiscount |
|
190 | rouge |
|
196 | rouge |
|
191 | rspec-rails (~> 2.99.0) |
|
197 | rspec-rails (~> 2.99.0) |
|
192 | sass-rails (~> 3.2.6) |
|
198 | sass-rails (~> 3.2.6) |
|
193 | select2-rails |
|
199 | select2-rails |
|
194 | test-unit |
|
200 | test-unit |
@@ -11,14 +11,14 | |||||
|
11 | // GO AFTER THE REQUIRES BELOW. |
|
11 | // GO AFTER THE REQUIRES BELOW. |
|
12 | // |
|
12 | // |
|
13 | //= require jquery |
|
13 | //= require jquery |
|
14 | //= require jquery_ujs |
|
14 | //= require jquery_ujs |
|
15 | //= require jquery.ui.all |
|
15 | //= require jquery.ui.all |
|
16 | //= require bootstrap-sprockets |
|
16 | //= require bootstrap-sprockets |
|
17 | - //x= require bootstrap-switch |
|
17 | + //= require moment |
|
18 |
- //= require bootstrap- |
|
18 | + //= require bootstrap-sortable |
|
19 | //= require select2 |
|
19 | //= require select2 |
|
20 | //= require custom |
|
20 | //= require custom |
|
21 | //= require ace-rails-ap |
|
21 | //= require ace-rails-ap |
|
22 | //= require ace/mode-c_cpp |
|
22 | //= require ace/mode-c_cpp |
|
23 | //= require ace/mode-ruby |
|
23 | //= require ace/mode-ruby |
|
24 | //= require ace/mode-pascal |
|
24 | //= require ace/mode-pascal |
@@ -34,13 +34,13 | |||||
|
34 | target = $(event.target) |
|
34 | target = $(event.target) |
|
35 | target.removeClass 'btn-default' |
|
35 | target.removeClass 'btn-default' |
|
36 | target.removeClass 'btn-success' |
|
36 | target.removeClass 'btn-success' |
|
37 | target.addClass 'btn-warning' |
|
37 | target.addClass 'btn-warning' |
|
38 | target.text '...' |
|
38 | target.text '...' |
|
39 | return |
|
39 | return |
|
40 | - |
|
40 | + |
|
41 | #ace editor |
|
41 | #ace editor |
|
42 | e = ace.edit("editor") |
|
42 | e = ace.edit("editor") |
|
43 | e.setTheme('ace/theme/merbivore') |
|
43 | e.setTheme('ace/theme/merbivore') |
|
44 | e.getSession().setTabSize(2) |
|
44 | e.getSession().setTabSize(2) |
|
45 | e.getSession().setUseSoftTabs(true) |
|
45 | e.getSession().setUseSoftTabs(true) |
|
46 |
|
46 |
@@ -29,12 +29,13 | |||||
|
29 | @import bootstrap-sprockets |
|
29 | @import bootstrap-sprockets |
|
30 | @import bootstrap |
|
30 | @import bootstrap |
|
31 | @import select2 |
|
31 | @import select2 |
|
32 | @import select2-bootstrap |
|
32 | @import select2-bootstrap |
|
33 | //@import bootstrap3-switch |
|
33 | //@import bootstrap3-switch |
|
34 | @import bootstrap-toggle |
|
34 | @import bootstrap-toggle |
|
|
35 | + @import bootstrap-sortable | ||
|
35 |
|
36 | ||
|
36 | //bootstrap navbar color (from) |
|
37 | //bootstrap navbar color (from) |
|
37 | $bgDefault : #19197b |
|
38 | $bgDefault : #19197b |
|
38 | $bgHighlight : #06064b |
|
39 | $bgHighlight : #06064b |
|
39 | $colDefault : #8e8eb4 |
|
40 | $colDefault : #8e8eb4 |
|
40 | $colHighlight : #ffffff |
|
41 | $colHighlight : #ffffff |
@@ -102,12 +103,14 | |||||
|
102 | color: $colHighlight |
|
103 | color: $colHighlight |
|
103 | background-color: $bgHighlight |
|
104 | background-color: $bgHighlight |
|
104 |
|
105 | ||
|
105 | .secondnavbar |
|
106 | .secondnavbar |
|
106 | top: 50px |
|
107 | top: 50px |
|
107 |
|
108 | ||
|
|
109 | + | ||
|
|
110 | + // --------------- bootstrap file upload ---------------------- | ||
|
108 | .btn-file |
|
111 | .btn-file |
|
109 | position: relative |
|
112 | position: relative |
|
110 | overflow: hidden |
|
113 | overflow: hidden |
|
111 |
|
114 | ||
|
112 | .btn-file input[type=file] |
|
115 | .btn-file input[type=file] |
|
113 | position: absolute |
|
116 | position: absolute |
@@ -127,14 +130,24 | |||||
|
127 | body |
|
130 | body |
|
128 | background: white image-url("topbg.jpg") repeat-x top center |
|
131 | background: white image-url("topbg.jpg") repeat-x top center |
|
129 | //font-size: 13px |
|
132 | //font-size: 13px |
|
130 | //font-family: Tahoma, "sans-serif" |
|
133 | //font-family: Tahoma, "sans-serif" |
|
131 | margin: 10px |
|
134 | margin: 10px |
|
132 | padding: 10px |
|
135 | padding: 10px |
|
133 |
- padding-top: |
|
136 | + padding-top: 60px |
|
134 |
|
137 | ||
|
|
138 | + // ------------------ bootstrap sortable -------------------- | ||
|
|
139 | + table.sortable th | ||
|
|
140 | + padding-right: 20px !important | ||
|
|
141 | + span.sign | ||
|
|
142 | + right: -15px !important | ||
|
|
143 | + &.text-right | ||
|
|
144 | + padding-left: 20px !important | ||
|
|
145 | + padding-right: 8px !important | ||
|
|
146 | + &:after, span.sign | ||
|
|
147 | + left: -15px !important | ||
|
135 |
|
148 | ||
|
136 | input |
|
149 | input |
|
137 | font-family: Tahoma, "sans-serif" |
|
150 | font-family: Tahoma, "sans-serif" |
|
138 |
|
151 | ||
|
139 |
|
152 | ||
|
140 | h1 |
|
153 | h1 |
@@ -9,12 +9,42 | |||||
|
9 | return true; |
|
9 | return true; |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | admin_authorization |
|
12 | admin_authorization |
|
13 | } |
|
13 | } |
|
14 |
|
14 | ||
|
|
15 | + def score | ||
|
|
16 | + if params[:commit] == 'download csv' | ||
|
|
17 | + @problems = Problem.all | ||
|
|
18 | + else | ||
|
|
19 | + @problems = Problem.find_available_problems | ||
|
|
20 | + end | ||
|
|
21 | + @users = User.includes(:contests, :contest_stat).where(enabled: true) #find(:all, :include => [:contests, :contest_stat]).where(enabled: true) | ||
|
|
22 | + @scorearray = Array.new | ||
|
|
23 | + @users.each do |u| | ||
|
|
24 | + ustat = Array.new | ||
|
|
25 | + ustat[0] = u | ||
|
|
26 | + @problems.each do |p| | ||
|
|
27 | + sub = Submission.find_last_by_user_and_problem(u.id,p.id) | ||
|
|
28 | + if (sub!=nil) and (sub.points!=nil) and p and p.full_score | ||
|
|
29 | + ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] | ||
|
|
30 | + else | ||
|
|
31 | + ustat << [0,false] | ||
|
|
32 | + end | ||
|
|
33 | + end | ||
|
|
34 | + @scorearray << ustat | ||
|
|
35 | + end | ||
|
|
36 | + if params[:commit] == 'download csv' then | ||
|
|
37 | + csv = gen_csv_from_scorearray(@scorearray,@problems) | ||
|
|
38 | + send_data csv, filename: 'last_score.csv' | ||
|
|
39 | + else | ||
|
|
40 | + render template: 'user_admin/user_stat' | ||
|
|
41 | + end | ||
|
|
42 | + | ||
|
|
43 | + end | ||
|
|
44 | + | ||
|
15 | def login_stat |
|
45 | def login_stat |
|
16 | @logins = Array.new |
|
46 | @logins = Array.new |
|
17 |
|
47 | ||
|
18 | date_and_time = '%Y-%m-%d %H:%M' |
|
48 | date_and_time = '%Y-%m-%d %H:%M' |
|
19 | begin |
|
49 | begin |
|
20 | md = params[:since_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/) |
|
50 | md = params[:since_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/) |
@@ -70,18 +100,13 | |||||
|
70 | @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } } |
|
100 | @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } } |
|
71 | end |
|
101 | end |
|
72 |
|
102 | ||
|
73 | Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s| |
|
103 | Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s| |
|
74 | if @submissions[s.user_id] |
|
104 | if @submissions[s.user_id] |
|
75 | if not @submissions[s.user_id][:sub].has_key?(s.problem_id) |
|
105 | if not @submissions[s.user_id][:sub].has_key?(s.problem_id) |
|
76 | - a = nil |
|
106 | + a = Problem.find_by_id(s.problem_id) |
|
77 | - begin |
|
||
|
78 | - a = Problem.find(s.problem_id) |
|
||
|
79 | - rescue |
|
||
|
80 | - a = nil |
|
||
|
81 | - end |
|
||
|
82 | @submissions[s.user_id][:sub][s.problem_id] = |
|
107 | @submissions[s.user_id][:sub][s.problem_id] = |
|
83 | { prob_name: (a ? a.full_name : '(NULL)'), |
|
108 | { prob_name: (a ? a.full_name : '(NULL)'), |
|
84 | sub_ids: [s.id] } |
|
109 | sub_ids: [s.id] } |
|
85 | else |
|
110 | else |
|
86 | @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id |
|
111 | @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id |
|
87 | end |
|
112 | end |
@@ -1,15 +1,15 | |||||
|
1 | - - content_for :header do |
|
1 | + /- content_for :header do |
|
2 |
- |
|
2 | + / = javascript_include_tag 'local_jquery' |
|
3 |
- |
|
3 | + / = stylesheet_link_tag 'tablesorter-theme.cafe' |
|
4 |
|
4 | ||
|
5 | %script{:type=>"text/javascript"} |
|
5 | %script{:type=>"text/javascript"} |
|
6 | $(function () { |
|
6 | $(function () { |
|
7 | $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); |
|
7 | $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); |
|
8 | $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); |
|
8 | $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); |
|
9 | - $('#my_table').tablesorter({widgets: ['zebra']}); |
|
9 | + /$('#my_table').tablesorter({widgets: ['zebra']}); |
|
10 | }); |
|
10 | }); |
|
11 |
|
11 | ||
|
12 | %h1 User grading results |
|
12 | %h1 User grading results |
|
13 | %h2= params[:action] == 'user_stat' ? "Show scores from latest submission" : "Show max scores in submission range" |
|
13 | %h2= params[:action] == 'user_stat' ? "Show scores from latest submission" : "Show max scores in submission range" |
|
14 |
|
14 | ||
|
15 |
|
15 | ||
@@ -23,37 +23,39 | |||||
|
23 | = link_to '[download csv with all problems]', controller: :user_admin, action: :user_stat, commit: 'download csv' |
|
23 | = link_to '[download csv with all problems]', controller: :user_admin, action: :user_stat, commit: 'download csv' |
|
24 | - else |
|
24 | - else |
|
25 | %h3 Max score |
|
25 | %h3 Max score |
|
26 | = link_to '[Show only latest submissions]', controller: :user_admin, action: :user_stat |
|
26 | = link_to '[Show only latest submissions]', controller: :user_admin, action: :user_stat |
|
27 | = link_to '[download csv with all problems]', controller: :user_admin, action: :user_stat_max, commit: 'download csv' |
|
27 | = link_to '[download csv with all problems]', controller: :user_admin, action: :user_stat_max, commit: 'download csv' |
|
28 |
|
28 | ||
|
29 | - %table.tablesorter-cafe#my_table |
|
29 | + %table.table.sortable.table-striped.table-bordered |
|
30 | %thead |
|
30 | %thead |
|
31 | %tr |
|
31 | %tr |
|
32 |
- %th |
|
32 | + %th Login |
|
33 | %th Name |
|
33 | %th Name |
|
34 | %th Activated? |
|
34 | %th Activated? |
|
35 |
- %th Logged |
|
35 | + %th Logged_in |
|
36 | %th Contest(s) |
|
36 | %th Contest(s) |
|
37 | %th Remark |
|
37 | %th Remark |
|
38 | - @problems.each do |p| |
|
38 | - @problems.each do |p| |
|
39 | - %th= p.name |
|
39 | + %th.text-right= p.name |
|
40 | - %th Total |
|
40 | + %th.text-right Total |
|
41 | - %th Passed |
|
41 | + %th.text-right Passed |
|
42 | %tbody |
|
42 | %tbody |
|
43 | - @scorearray.each do |sc| |
|
43 | - @scorearray.each do |sc| |
|
44 | - %tr{class: cycle('info-even','info-odd')} |
|
44 | + %tr |
|
45 | - total,num_passed = 0,0 |
|
45 | - total,num_passed = 0,0 |
|
46 | - sc.each_index do |i| |
|
46 | - sc.each_index do |i| |
|
47 | - if i == 0 |
|
47 | - if i == 0 |
|
48 | %td= link_to sc[i].login, controller: 'users', action: 'profile', id: sc[i] |
|
48 | %td= link_to sc[i].login, controller: 'users', action: 'profile', id: sc[i] |
|
49 | %td= sc[i].full_name |
|
49 | %td= sc[i].full_name |
|
50 | %td= sc[i].activated |
|
50 | %td= sc[i].activated |
|
51 | %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' |
|
51 | %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' |
|
52 | %td= sc[i].contests.collect {|c| c.name}.join(', ') |
|
52 | %td= sc[i].contests.collect {|c| c.name}.join(', ') |
|
53 | %td= sc[i].remark |
|
53 | %td= sc[i].remark |
|
54 | - else |
|
54 | - else |
|
55 | - %td= sc[i][0] |
|
55 | + %td.text-right= sc[i][0] |
|
56 | - total += sc[i][0] |
|
56 | - total += sc[i][0] |
|
57 | - num_passed += 1 if sc[i][1] |
|
57 | - num_passed += 1 if sc[i][1] |
|
58 | - %td= total |
|
58 | + %td.text-right= total |
|
59 | - %td= num_passed |
|
59 | + %td.text-right= num_passed |
|
|
60 | + :javascript | ||
|
|
61 | + $.bootstrapSortable(true,'reversed') |
You need to be logged in to leave comments.
Login now