Description:
submission stat
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r788:3241620ac7e7 - - 10 files changed: 425 inserted, 296 deleted
@@ -0,0 +1,61 | |||
|
1 | + - content_for :header do | |
|
2 | + = javascript_include_tag 'local_jquery' | |
|
3 | + | |
|
4 | + %h1 Submissions detail | |
|
5 | + | |
|
6 | + .row | |
|
7 | + .col-md-4 | |
|
8 | + = render partial: 'shared/problem_select' | |
|
9 | + .col-md-4 | |
|
10 | + = render partial: 'shared/problem_select' | |
|
11 | + .col-md-4 | |
|
12 | + = render partial: 'shared/user_select' | |
|
13 | + | |
|
14 | + | |
|
15 | + .row | |
|
16 | + .col-12 | |
|
17 | + %table.table.table-hover.table-condense.datatable | |
|
18 | + -# | |
|
19 | + %thead | |
|
20 | + %tr | |
|
21 | + %th User | |
|
22 | + %th Problem | |
|
23 | + %th Subbmission ID | |
|
24 | + %th Submit Time | |
|
25 | + %th Score | |
|
26 | + %th detail | |
|
27 | + %tbody | |
|
28 | + - @submissions.each do |s| | |
|
29 | + %tr | |
|
30 | + %td= s.user.login | |
|
31 | + %td= s.problem.long_name | |
|
32 | + %td= s.id | |
|
33 | + %td= s.submitted_at | |
|
34 | + %td= s.points | |
|
35 | + %td= s.grader_comment | |
|
36 | + | |
|
37 | + | |
|
38 | + :javascript | |
|
39 | + $('.datatable').DataTable({ | |
|
40 | + columns: [ | |
|
41 | + {title: 'User', data: 'login'}, | |
|
42 | + {title: 'Problem', data: 'problem.long_name'}, | |
|
43 | + {title: 'Sub ID', data: 'id'}, | |
|
44 | + {title: 'Submit at', data: 'submitted_at'}, | |
|
45 | + {title: 'Points', data: 'points'}, | |
|
46 | + {title: 'detail', data: 'grader_comment'}, | |
|
47 | + ], | |
|
48 | + ajax: { | |
|
49 | + url: '#{submission_query_report_path}', | |
|
50 | + type: 'POST', | |
|
51 | + data: (d) => { | |
|
52 | + d.since_datetime = '1123' | |
|
53 | + d.until_datetime = 'xxx' | |
|
54 | + }, | |
|
55 | + dataType: 'json', | |
|
56 | + beforeSend: (request) => { | |
|
57 | + request.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); | |
|
58 | + }, | |
|
59 | + }, //end ajax | |
|
60 | + 'pageLength': 50 | |
|
61 | + }); |
@@ -0,0 +1,15 | |||
|
1 | + json.draw params['draw']&.to_i | |
|
2 | + json.recordsTotal @recordsTotal | |
|
3 | + json.recordsFiltered @recordsFiltered | |
|
4 | + json.data do | |
|
5 | + json.array! @submissions do |sub| | |
|
6 | + json.extact! sub, :id, :points, :grader_comment | |
|
7 | + json.submitted_at sub.submitted_at | |
|
8 | + json.problem do | |
|
9 | + json.long_name sub.problem&.long_name | |
|
10 | + end | |
|
11 | + json.user do | |
|
12 | + json.login sub.user&.login | |
|
13 | + end | |
|
14 | + end | |
|
15 | + end |
@@ -0,0 +1,10 | |||
|
1 | + .panel.panel-primary | |
|
2 | + .panel-heading | |
|
3 | + Problems | |
|
4 | + .panel-body | |
|
5 | + %p | |
|
6 | + Select problem(s) that we wish to know the score. | |
|
7 | + = label_tag :problem_id, "Problems" | |
|
8 | + = select_tag 'problem_id[]', | |
|
9 | + options_for_select(Problem.all.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]},params[:problem_id]), | |
|
10 | + { class: 'select2 form-control', multiple: "true" } |
@@ -0,0 +1,12 | |||
|
1 | + .panel.panel-primary | |
|
2 | + .panel-heading | |
|
3 | + Users | |
|
4 | + .panel-body | |
|
5 | + .radio | |
|
6 | + %label | |
|
7 | + = radio_button_tag 'users', 'all', (params[:users] == "all") | |
|
8 | + All users | |
|
9 | + .radio | |
|
10 | + %label | |
|
11 | + = radio_button_tag 'users', 'enabled', (params[:users] == "enabled") | |
|
12 | + Only enabled users |
@@ -5,37 +5,37 | |||
|
5 | 5 | ZenTest (~> 4.3) |
|
6 | 6 | ZenTest (4.11.2) |
|
7 | 7 | ace-rails-ap (4.2) |
|
8 |
- actioncable (5.2. |
|
|
9 |
- actionpack (= 5.2. |
|
|
8 | + actioncable (5.2.4.2) | |
|
9 | + actionpack (= 5.2.4.2) | |
|
10 | 10 | nio4r (~> 2.0) |
|
11 | 11 | websocket-driver (>= 0.6.1) |
|
12 |
- actionmailer (5.2. |
|
|
13 |
- actionpack (= 5.2. |
|
|
14 |
- actionview (= 5.2. |
|
|
15 |
- activejob (= 5.2. |
|
|
12 | + actionmailer (5.2.4.2) | |
|
13 | + actionpack (= 5.2.4.2) | |
|
14 | + actionview (= 5.2.4.2) | |
|
15 | + activejob (= 5.2.4.2) | |
|
16 | 16 | mail (~> 2.5, >= 2.5.4) |
|
17 | 17 | rails-dom-testing (~> 2.0) |
|
18 |
- actionpack (5.2. |
|
|
19 |
- actionview (= 5.2. |
|
|
20 |
- activesupport (= 5.2. |
|
|
21 | - rack (~> 2.0) | |
|
18 | + actionpack (5.2.4.2) | |
|
19 | + actionview (= 5.2.4.2) | |
|
20 | + activesupport (= 5.2.4.2) | |
|
21 | + rack (~> 2.0, >= 2.0.8) | |
|
22 | 22 | rack-test (>= 0.6.3) |
|
23 | 23 | rails-dom-testing (~> 2.0) |
|
24 | 24 | rails-html-sanitizer (~> 1.0, >= 1.0.2) |
|
25 |
- actionview (5.2. |
|
|
26 |
- activesupport (= 5.2. |
|
|
25 | + actionview (5.2.4.2) | |
|
26 | + activesupport (= 5.2.4.2) | |
|
27 | 27 | builder (~> 3.1) |
|
28 | 28 | erubi (~> 1.4) |
|
29 | 29 | rails-dom-testing (~> 2.0) |
|
30 | 30 | rails-html-sanitizer (~> 1.0, >= 1.0.3) |
|
31 |
- activejob (5.2. |
|
|
32 |
- activesupport (= 5.2. |
|
|
31 | + activejob (5.2.4.2) | |
|
32 | + activesupport (= 5.2.4.2) | |
|
33 | 33 | globalid (>= 0.3.6) |
|
34 |
- activemodel (5.2. |
|
|
35 |
- activesupport (= 5.2. |
|
|
36 |
- activerecord (5.2. |
|
|
37 |
- activemodel (= 5.2. |
|
|
38 |
- activesupport (= 5.2. |
|
|
34 | + activemodel (5.2.4.2) | |
|
35 | + activesupport (= 5.2.4.2) | |
|
36 | + activerecord (5.2.4.2) | |
|
37 | + activemodel (= 5.2.4.2) | |
|
38 | + activesupport (= 5.2.4.2) | |
|
39 | 39 | arel (>= 9.0) |
|
40 | 40 | activerecord-session_store (1.1.3) |
|
41 | 41 | actionpack (>= 4.0) |
@@ -43,26 +43,26 | |||
|
43 | 43 | multi_json (~> 1.11, >= 1.11.2) |
|
44 | 44 | rack (>= 1.5.2, < 3) |
|
45 | 45 | railties (>= 4.0) |
|
46 |
- activestorage (5.2. |
|
|
47 |
- actionpack (= 5.2. |
|
|
48 |
- activerecord (= 5.2. |
|
|
46 | + activestorage (5.2.4.2) | |
|
47 | + actionpack (= 5.2.4.2) | |
|
48 | + activerecord (= 5.2.4.2) | |
|
49 | 49 | marcel (~> 0.3.1) |
|
50 |
- activesupport (5.2. |
|
|
50 | + activesupport (5.2.4.2) | |
|
51 | 51 | concurrent-ruby (~> 1.0, >= 1.0.2) |
|
52 | 52 | i18n (>= 0.7, < 2) |
|
53 | 53 | minitest (~> 5.1) |
|
54 | 54 | tzinfo (~> 1.1) |
|
55 |
- addressable (2. |
|
|
56 |
- public_suffix (>= 2.0.2, < |
|
|
55 | + addressable (2.7.0) | |
|
56 | + public_suffix (>= 2.0.2, < 5.0) | |
|
57 | 57 | ansi (1.5.0) |
|
58 | 58 | arel (9.0.0) |
|
59 |
- autoprefixer-rails (9.5.1 |
|
|
59 | + autoprefixer-rails (9.5.1) | |
|
60 | 60 | execjs |
|
61 | 61 | best_in_place (3.0.3) |
|
62 | 62 | actionpack (>= 3.2) |
|
63 | 63 | railties (>= 3.2) |
|
64 |
- bindex (0. |
|
|
65 |
- bootsnap (1.4. |
|
|
64 | + bindex (0.8.1) | |
|
65 | + bootsnap (1.4.6) | |
|
66 | 66 | msgpack (~> 1.0) |
|
67 | 67 | bootstrap-datepicker-rails (1.8.0.1) |
|
68 | 68 | railties (>= 3.0) |
@@ -73,21 +73,17 | |||
|
73 | 73 | bootstrap-toggle-rails (2.2.1.0) |
|
74 | 74 | bootstrap3-datetimepicker-rails (4.17.47) |
|
75 | 75 | momentjs-rails (>= 2.8.1) |
|
76 |
- builder (3.2. |
|
|
76 | + builder (3.2.4) | |
|
77 | 77 | byebug (11.0.1) |
|
78 |
- capybara (3. |
|
|
78 | + capybara (3.15.1) | |
|
79 | 79 | addressable |
|
80 | 80 | mini_mime (>= 0.1.3) |
|
81 | 81 | nokogiri (~> 1.8) |
|
82 | 82 | rack (>= 1.6.0) |
|
83 | 83 | rack-test (>= 0.6.3) |
|
84 |
- regexp_parser (~> 1. |
|
|
84 | + regexp_parser (~> 1.2) | |
|
85 | 85 | xpath (~> 3.2) |
|
86 | - capybara-console (0.0.4) | |
|
87 | - capybara | |
|
88 | - rails (>= 3.0) | |
|
89 | - childprocess (1.0.1) | |
|
90 | - rake (< 13.0) | |
|
86 | + childprocess (3.0.0) | |
|
91 | 87 | coffee-rails (4.2.2) |
|
92 | 88 | coffee-script (>= 2.2.0) |
|
93 | 89 | railties (>= 4.0.0) |
@@ -95,18 +91,18 | |||
|
95 | 91 | coffee-script-source |
|
96 | 92 | execjs |
|
97 | 93 | coffee-script-source (1.12.2) |
|
98 |
- concurrent-ruby (1.1. |
|
|
99 |
- crass (1.0. |
|
|
94 | + concurrent-ruby (1.1.6) | |
|
95 | + crass (1.0.6) | |
|
100 | 96 | dynamic_form (1.1.4) |
|
101 |
- erubi (1. |
|
|
97 | + erubi (1.9.0) | |
|
102 | 98 | erubis (2.7.0) |
|
103 | 99 | execjs (2.7.0) |
|
104 |
- ffi (1.1 |
|
|
100 | + ffi (1.10.0) | |
|
105 | 101 | fuzzy-string-match (1.0.1) |
|
106 | 102 | RubyInline (>= 3.8.6) |
|
107 | 103 | globalid (0.4.2) |
|
108 | 104 | activesupport (>= 4.2.0) |
|
109 |
- haml (5. |
|
|
105 | + haml (5.0.4) | |
|
110 | 106 | temple (>= 0.8.0) |
|
111 | 107 | tilt |
|
112 | 108 | haml-rails (1.0.0) |
@@ -120,11 +116,11 | |||
|
120 | 116 | haml (>= 4.0, < 6) |
|
121 | 117 | nokogiri (>= 1.6.0) |
|
122 | 118 | ruby_parser (~> 3.5) |
|
123 |
- i18n (1. |
|
|
119 | + i18n (1.8.2) | |
|
124 | 120 | concurrent-ruby (~> 1.0) |
|
125 | 121 | in_place_editing (1.2.0) |
|
126 |
- jbuilder (2. |
|
|
127 |
- activesupport (>= |
|
|
122 | + jbuilder (2.10.0) | |
|
123 | + activesupport (>= 5.0.0) | |
|
128 | 124 | jquery-countdown-rails (2.0.2) |
|
129 | 125 | jquery-datatables-rails (3.4.0) |
|
130 | 126 | actionpack (>= 3.1) |
@@ -145,18 +141,18 | |||
|
145 | 141 | rb-fsevent (~> 0.9, >= 0.9.4) |
|
146 | 142 | rb-inotify (~> 0.9, >= 0.9.7) |
|
147 | 143 | ruby_dep (~> 1.2) |
|
148 |
- loofah (2. |
|
|
144 | + loofah (2.4.0) | |
|
149 | 145 | crass (~> 1.0.2) |
|
150 | 146 | nokogiri (>= 1.5.9) |
|
151 | 147 | mail (2.7.1) |
|
152 | 148 | mini_mime (>= 0.1.1) |
|
153 | 149 | marcel (0.3.3) |
|
154 | 150 | mimemagic (~> 0.3.2) |
|
155 |
- method_source ( |
|
|
156 |
- mimemagic (0.3. |
|
|
157 |
- mini_mime (1.0. |
|
|
151 | + method_source (1.0.0) | |
|
152 | + mimemagic (0.3.4) | |
|
153 | + mini_mime (1.0.2) | |
|
158 | 154 | mini_portile2 (2.4.0) |
|
159 |
- minitest (5.1 |
|
|
155 | + minitest (5.14.0) | |
|
160 | 156 | minitest-reporters (1.3.6) |
|
161 | 157 | ansi |
|
162 | 158 | builder |
@@ -164,30 +160,30 | |||
|
164 | 160 | ruby-progressbar |
|
165 | 161 | momentjs-rails (2.20.1) |
|
166 | 162 | railties (>= 3.1) |
|
167 |
- msgpack (1.3. |
|
|
163 | + msgpack (1.3.3) | |
|
168 | 164 | multi_json (1.13.1) |
|
169 | 165 | mysql2 (0.5.2) |
|
170 |
- nio4r (2. |
|
|
171 |
- nokogiri (1.10. |
|
|
166 | + nio4r (2.5.2) | |
|
167 | + nokogiri (1.10.9) | |
|
172 | 168 | mini_portile2 (~> 2.4.0) |
|
173 |
- public_suffix ( |
|
|
174 |
- puma (4. |
|
|
169 | + public_suffix (4.0.3) | |
|
170 | + puma (4.3.3) | |
|
175 | 171 | nio4r (~> 2.0) |
|
176 |
- rack (2. |
|
|
172 | + rack (2.2.2) | |
|
177 | 173 | rack-test (1.1.0) |
|
178 | 174 | rack (>= 1.0, < 3) |
|
179 |
- rails (5.2. |
|
|
180 |
- actioncable (= 5.2. |
|
|
181 |
- actionmailer (= 5.2. |
|
|
182 |
- actionpack (= 5.2. |
|
|
183 |
- actionview (= 5.2. |
|
|
184 |
- activejob (= 5.2. |
|
|
185 |
- activemodel (= 5.2. |
|
|
186 |
- activerecord (= 5.2. |
|
|
187 |
- activestorage (= 5.2. |
|
|
188 |
- activesupport (= 5.2. |
|
|
175 | + rails (5.2.4.2) | |
|
176 | + actioncable (= 5.2.4.2) | |
|
177 | + actionmailer (= 5.2.4.2) | |
|
178 | + actionpack (= 5.2.4.2) | |
|
179 | + actionview (= 5.2.4.2) | |
|
180 | + activejob (= 5.2.4.2) | |
|
181 | + activemodel (= 5.2.4.2) | |
|
182 | + activerecord (= 5.2.4.2) | |
|
183 | + activestorage (= 5.2.4.2) | |
|
184 | + activesupport (= 5.2.4.2) | |
|
189 | 185 | bundler (>= 1.3.0) |
|
190 |
- railties (= 5.2. |
|
|
186 | + railties (= 5.2.4.2) | |
|
191 | 187 | sprockets-rails (>= 2.0.0) |
|
192 | 188 | rails-controller-testing (1.0.4) |
|
193 | 189 | actionpack (>= 5.0.1.x) |
@@ -196,28 +192,28 | |||
|
196 | 192 | rails-dom-testing (2.0.3) |
|
197 | 193 | activesupport (>= 4.2.0) |
|
198 | 194 | nokogiri (>= 1.6) |
|
199 |
- rails-html-sanitizer (1. |
|
|
200 |
- loofah (~> 2. |
|
|
195 | + rails-html-sanitizer (1.3.0) | |
|
196 | + loofah (~> 2.3) | |
|
201 | 197 | rails_bootstrap_sortable (2.0.6) |
|
202 | 198 | momentjs-rails (>= 2.8.3) |
|
203 |
- railties (5.2. |
|
|
204 |
- actionpack (= 5.2. |
|
|
205 |
- activesupport (= 5.2. |
|
|
199 | + railties (5.2.4.2) | |
|
200 | + actionpack (= 5.2.4.2) | |
|
201 | + activesupport (= 5.2.4.2) | |
|
206 | 202 | method_source |
|
207 | 203 | rake (>= 0.8.7) |
|
208 | 204 | thor (>= 0.19.0, < 2.0) |
|
209 |
- rake (1 |
|
|
205 | + rake (13.0.1) | |
|
210 | 206 | rb-fsevent (0.10.3) |
|
211 | 207 | rb-inotify (0.10.0) |
|
212 | 208 | ffi (~> 1.0) |
|
213 | 209 | rdiscount (2.2.0.1) |
|
214 |
- regexp_parser (1. |
|
|
210 | + regexp_parser (1.7.0) | |
|
215 | 211 | rouge (3.3.0) |
|
216 | 212 | ruby-progressbar (1.10.0) |
|
217 | 213 | ruby_dep (1.5.0) |
|
218 | 214 | ruby_parser (3.13.1) |
|
219 | 215 | sexp_processor (~> 4.9) |
|
220 |
- rubyzip (1. |
|
|
216 | + rubyzip (1.3.0) | |
|
221 | 217 | sass (3.7.4) |
|
222 | 218 | sass-listen (~> 4.0.0) |
|
223 | 219 | sass-listen (4.0.0) |
@@ -229,10 +225,9 | |||
|
229 | 225 | sprockets (>= 2.8, < 4.0) |
|
230 | 226 | sprockets-rails (>= 2.0, < 4.0) |
|
231 | 227 | tilt (>= 1.1, < 3) |
|
232 |
- sassc (2. |
|
|
228 | + sassc (2.2.1) | |
|
233 | 229 | ffi (~> 1.9) |
|
234 | - rake | |
|
235 | - sassc-rails (2.1.1) | |
|
230 | + sassc-rails (2.1.2) | |
|
236 | 231 | railties (>= 4.0.0) |
|
237 | 232 | sassc (>= 2.0) |
|
238 | 233 | sprockets (> 3.0) |
@@ -240,14 +235,15 | |||
|
240 | 235 | tilt |
|
241 | 236 | select2-rails (4.0.3) |
|
242 | 237 | thor (~> 0.14) |
|
243 |
- selenium-webdriver (3.142. |
|
|
244 |
- childprocess (>= 0.5, < |
|
|
245 |
- rubyzip ( |
|
|
238 | + selenium-webdriver (3.142.7) | |
|
239 | + childprocess (>= 0.5, < 4.0) | |
|
240 | + rubyzip (>= 1.2.2) | |
|
246 | 241 | sexp_processor (4.12.0) |
|
247 |
- simple_form ( |
|
|
242 | + simple_form (5.0.2) | |
|
248 | 243 | actionpack (>= 5.0) |
|
249 | 244 | activemodel (>= 5.0) |
|
250 |
- spring (2. |
|
|
245 | + spring (2.0.2) | |
|
246 | + activesupport (>= 4.2) | |
|
251 | 247 | spring-watcher-listen (2.0.1) |
|
252 | 248 | listen (>= 2.7, < 4.0) |
|
253 | 249 | spring (>= 1.2, < 3.0) |
@@ -263,7 +259,7 | |||
|
263 | 259 | thor (0.20.3) |
|
264 | 260 | thread_safe (0.3.6) |
|
265 | 261 | tilt (2.0.9) |
|
266 |
- tzinfo (1.2. |
|
|
262 | + tzinfo (1.2.7) | |
|
267 | 263 | thread_safe (~> 0.1) |
|
268 | 264 | uglifier (4.1.20) |
|
269 | 265 | execjs (>= 0.3.0, < 3) |
@@ -272,7 +268,7 | |||
|
272 | 268 | activemodel (>= 5.0) |
|
273 | 269 | bindex (>= 0.4.0) |
|
274 | 270 | railties (>= 5.0) |
|
275 |
- webdriver (0. |
|
|
271 | + webdriver (0.5.0) | |
|
276 | 272 | websocket-driver (0.7.1) |
|
277 | 273 | websocket-extensions (>= 0.1.0) |
|
278 | 274 | websocket-extensions (0.1.4) |
@@ -299,7 +295,6 | |||
|
299 | 295 | bootstrap3-datetimepicker-rails |
|
300 | 296 | byebug |
|
301 | 297 | capybara (>= 2.15) |
|
302 | - capybara-console | |
|
303 | 298 | coffee-rails |
|
304 | 299 | dynamic_form |
|
305 | 300 | fuzzy-string-match |
@@ -338,4 +333,4 | |||
|
338 | 333 | yaml_db |
|
339 | 334 | |
|
340 | 335 | BUNDLED WITH |
|
341 |
- 1.1 |
|
|
336 | + 1.16.2 |
@@ -164,4 +164,65 | |||
|
164 | 164 | return true |
|
165 | 165 | end |
|
166 | 166 | |
|
167 | + #function for datatable ajax query | |
|
168 | + #return record,total_count,filter_count | |
|
169 | + def process_query_record(record, | |
|
170 | + total_count: nil, | |
|
171 | + select: '', | |
|
172 | + global_search: [], | |
|
173 | + no_search: false, | |
|
174 | + force_order: '', | |
|
175 | + date_filter: '', date_param_since: 'date_since',date_param_until: 'date_until') | |
|
176 | + arel_table = record.model.arel_table | |
|
177 | + | |
|
178 | + if !no_search && params['search'] | |
|
179 | + global_value = record.model.sanitize_sql(params['search']['value'].strip.downcase) | |
|
180 | + if !global_value.blank? | |
|
181 | + global_value.split.each do |value| | |
|
182 | + global_where = global_search.map{|f| "LOWER(#{f}) like '%#{value}%'"}.join(' OR ') | |
|
183 | + record = record.where(global_where) | |
|
167 | 184 | end |
|
185 | + end | |
|
186 | + | |
|
187 | + params['columns'].each do |i, col| | |
|
188 | + if !col['search']['value'].blank? | |
|
189 | + record = record.where(arel_table[col['name']].lower.matches("%#{col['search']['value'].strip.downcase}%")) | |
|
190 | + end | |
|
191 | + end | |
|
192 | + end | |
|
193 | + | |
|
194 | + if !date_filter.blank? | |
|
195 | + date_since = Time.parse( params[:date_since] ) rescue Time.new(1,1,1) | |
|
196 | + date_until = Time.parse( params[:date_until] ) rescue Time.zone.now() | |
|
197 | + date_range = date_since..date_until | |
|
198 | + record = record.where(date_filter.to_sym => date_range) | |
|
199 | + end | |
|
200 | + | |
|
201 | + if force_order.blank? | |
|
202 | + if params['order'] | |
|
203 | + params['order'].each do |i, o| | |
|
204 | + colName = params['columns'][o['column']]['name'] | |
|
205 | + colName = "#{record.model.table_name}.#{colName}" if colName.upcase == 'ID' | |
|
206 | + record = record.order("#{colName} #{o['dir'].casecmp('desc') != 0 ? 'ASC' : 'DESC'}") unless colName.blank? | |
|
207 | + end | |
|
208 | + end | |
|
209 | + else | |
|
210 | + record = record.order(force_order) | |
|
211 | + end | |
|
212 | + | |
|
213 | + filterCount = record.count(record.model.primary_key) | |
|
214 | + # if .group() is used, filterCount might be like {id_1: count_1, id_2: count_2, ...} | |
|
215 | + # so we should count the result again.. | |
|
216 | + if filterCount.is_a? Hash | |
|
217 | + filterCount = filterCount.count | |
|
218 | + end | |
|
219 | + | |
|
220 | + record = record.offset(params['start'] || 0).limit(params['length'] || 100) | |
|
221 | + if (!select.blank?) | |
|
222 | + record = record.select(select) | |
|
223 | + end | |
|
224 | + | |
|
225 | + return record, total_count || record.model.count, filterCount | |
|
226 | + end | |
|
227 | + | |
|
228 | + end |
@@ -142,8 +142,7 | |||
|
142 | 142 | end |
|
143 | 143 | end |
|
144 | 144 | |
|
145 |
- def submission |
|
|
146 | - | |
|
145 | + def submission | |
|
147 | 146 | date_and_time = '%Y-%m-%d %H:%M' |
|
148 | 147 | begin |
|
149 | 148 | @since_time = DateTime.strptime(params[:since_datetime],date_and_time) |
@@ -156,25 +155,22 | |||
|
156 | 155 | @until_time = DateTime.new(3000,1,1) |
|
157 | 156 | end |
|
158 | 157 | |
|
159 |
- @submissions = |
|
|
160 | - | |
|
161 | - User.find_each do |user| | |
|
162 | - @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } } | |
|
158 | + @submissions = Submission | |
|
159 | + .joins(:problem).joins(:user) | |
|
160 | + .where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time) | |
|
163 | 161 |
|
|
164 | 162 | |
|
165 | - Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s| | |
|
166 |
- |
|
|
167 | - if not @submissions[s.user_id][:sub].has_key?(s.problem_id) | |
|
168 | - a = Problem.find_by_id(s.problem_id) | |
|
169 | - @submissions[s.user_id][:sub][s.problem_id] = | |
|
170 | - { prob_name: (a ? a.full_name : '(NULL)'), | |
|
171 | - sub_ids: [s.id] } | |
|
172 | - else | |
|
173 | - @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id | |
|
174 | - end | |
|
175 | - @submissions[s.user_id][:count] += 1 | |
|
176 | - end | |
|
177 | - end | |
|
163 | + def submission_query | |
|
164 | + @submissions = Submission | |
|
165 | + .joins(:problem).joins(:user) | |
|
166 | + .where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time) | |
|
167 | + | |
|
168 | + @submissions, @recordsTotal, @recordsFiltered = process_query_record( @submissions, | |
|
169 | + global_search: ['user.login','user.full_name','problem.name','problem.full_name','points'], | |
|
170 | + date_filter: 'submitted_at', | |
|
171 | + date_param_since: 'since_datetime', | |
|
172 | + date_param_until: 'until_datetime', | |
|
173 | + ) | |
|
178 | 174 | end |
|
179 | 175 | |
|
180 | 176 | def problem_hof |
@@ -152,6 +152,8 | |||
|
152 | 152 | post 'cheat_report' |
|
153 | 153 | get 'cheat_scruntinize' |
|
154 | 154 | post 'cheat_scruntinize' |
|
155 | + get 'submission' | |
|
156 | + post 'submission_query' | |
|
155 | 157 | end |
|
156 | 158 | #get 'report/current_score', to: 'report#current_score', as: 'report_current_score' |
|
157 | 159 | #get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
@@ -1,3 +1,4 | |||
|
1 | + # encoding: UTF-8 | |
|
1 | 2 | # This file is auto-generated from the current state of the database. Instead |
|
2 | 3 | # of editing this file, please use the migrations feature of Active Record to |
|
3 | 4 | # incrementally modify your database, and then regenerate this schema definition. |
@@ -10,298 +11,311 | |||
|
10 | 11 | # |
|
11 | 12 | # It's strongly recommended that you check this file into your version control system. |
|
12 | 13 | |
|
13 |
- ActiveRecord::Schema.define(version: 2018 |
|
|
14 | + ActiveRecord::Schema.define(version: 20180612102327) do | |
|
14 | 15 | |
|
15 |
- create_table "announcements |
|
|
16 | - t.string "author" | |
|
17 | - t.text "body" | |
|
16 | + create_table "announcements", force: :cascade do |t| | |
|
17 | + t.string "author", limit: 255 | |
|
18 | + t.text "body", limit: 65535 | |
|
18 | 19 | t.boolean "published" |
|
19 | 20 | t.datetime "created_at" |
|
20 | 21 | t.datetime "updated_at" |
|
21 | 22 | t.boolean "frontpage", default: false |
|
22 | 23 | t.boolean "contest_only", default: false |
|
23 | - t.string "title" | |
|
24 | - t.string "notes" | |
|
24 | + t.string "title", limit: 255 | |
|
25 | + t.string "notes", limit: 255 | |
|
25 | 26 | end |
|
26 | 27 | |
|
27 |
- create_table "contests |
|
|
28 | - t.string "title" | |
|
28 | + create_table "contests", force: :cascade do |t| | |
|
29 | + t.string "title", limit: 255 | |
|
29 | 30 | t.boolean "enabled" |
|
30 | 31 | t.datetime "created_at" |
|
31 | 32 | t.datetime "updated_at" |
|
32 | - t.string "name" | |
|
33 | + t.string "name", limit: 255 | |
|
33 | 34 | end |
|
34 | 35 | |
|
35 |
- create_table "contests_problems", id: false, |
|
|
36 | - t.integer "contest_id" | |
|
37 | - t.integer "problem_id" | |
|
36 | + create_table "contests_problems", id: false, force: :cascade do |t| | |
|
37 | + t.integer "contest_id", limit: 4 | |
|
38 | + t.integer "problem_id", limit: 4 | |
|
38 | 39 | end |
|
39 | 40 | |
|
40 |
- create_table "contests_users", id: false, |
|
|
41 | - t.integer "contest_id" | |
|
42 | - t.integer "user_id" | |
|
41 | + create_table "contests_users", id: false, force: :cascade do |t| | |
|
42 | + t.integer "contest_id", limit: 4 | |
|
43 | + t.integer "user_id", limit: 4 | |
|
43 | 44 | end |
|
44 | 45 | |
|
45 |
- create_table "countries |
|
|
46 | - t.string "name" | |
|
46 | + create_table "countries", force: :cascade do |t| | |
|
47 | + t.string "name", limit: 255 | |
|
47 | 48 | t.datetime "created_at" |
|
48 | 49 | t.datetime "updated_at" |
|
49 | 50 | end |
|
50 | 51 | |
|
51 |
- create_table "descriptions |
|
|
52 | - t.text "body" | |
|
52 | + create_table "descriptions", force: :cascade do |t| | |
|
53 | + t.text "body", limit: 65535 | |
|
53 | 54 | t.boolean "markdowned" |
|
54 | 55 | t.datetime "created_at" |
|
55 | 56 | t.datetime "updated_at" |
|
56 | 57 | end |
|
57 | 58 | |
|
58 |
- create_table "grader_configurations |
|
|
59 | - t.string "key" | |
|
60 | - t.string "value_type" | |
|
61 | - t.string "value" | |
|
59 | + create_table "grader_configurations", force: :cascade do |t| | |
|
60 | + t.string "key", limit: 255 | |
|
61 | + t.string "value_type", limit: 255 | |
|
62 | + t.string "value", limit: 255 | |
|
62 | 63 | t.datetime "created_at" |
|
63 | 64 | t.datetime "updated_at" |
|
64 | - t.text "description" | |
|
65 | + t.text "description", limit: 65535 | |
|
65 | 66 | end |
|
66 | 67 | |
|
67 |
- create_table "grader_processes |
|
|
68 | - t.string "host" | |
|
69 | - t.integer "pid" | |
|
70 | - t.string "mode" | |
|
68 | + create_table "grader_processes", force: :cascade do |t| | |
|
69 | + t.string "host", limit: 255 | |
|
70 | + t.integer "pid", limit: 4 | |
|
71 | + t.string "mode", limit: 255 | |
|
71 | 72 | t.boolean "active" |
|
72 | 73 | t.datetime "created_at" |
|
73 | 74 | t.datetime "updated_at" |
|
74 | - t.integer "task_id" | |
|
75 | - t.string "task_type" | |
|
75 | + t.integer "task_id", limit: 4 | |
|
76 | + t.string "task_type", limit: 255 | |
|
76 | 77 | t.boolean "terminated" |
|
77 | - t.index ["host", "pid"], name: "index_grader_processes_on_host_and_pid" | |
|
78 | 78 | end |
|
79 | 79 | |
|
80 | - create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
81 | - t.string "name" | |
|
82 | - t.string "description" | |
|
80 | + add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_host_and_pid", using: :btree | |
|
81 | + | |
|
82 | + create_table "groups", force: :cascade do |t| | |
|
83 | + t.string "name", limit: 255 | |
|
84 | + t.string "description", limit: 255 | |
|
83 | 85 | end |
|
84 | 86 | |
|
85 |
- create_table "groups_problems", id: false, |
|
|
86 | - t.integer "problem_id", null: false | |
|
87 | - t.integer "group_id", null: false | |
|
88 | - t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id" | |
|
87 | + create_table "groups_problems", id: false, force: :cascade do |t| | |
|
88 | + t.integer "problem_id", limit: 4, null: false | |
|
89 | + t.integer "group_id", limit: 4, null: false | |
|
89 | 90 | end |
|
90 | 91 | |
|
91 | - create_table "groups_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
92 | - t.integer "group_id", null: false | |
|
93 | - t.integer "user_id", null: false | |
|
94 | - t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id" | |
|
92 | + add_index "groups_problems", ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id", using: :btree | |
|
93 | + | |
|
94 | + create_table "groups_users", id: false, force: :cascade do |t| | |
|
95 | + t.integer "group_id", limit: 4, null: false | |
|
96 | + t.integer "user_id", limit: 4, null: false | |
|
95 | 97 | end |
|
96 | 98 | |
|
97 | - create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
98 | - t.integer "user_id" | |
|
99 | - t.string "ip_address" | |
|
99 | + add_index "groups_users", ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id", using: :btree | |
|
100 | + | |
|
101 | + create_table "heart_beats", force: :cascade do |t| | |
|
102 | + t.integer "user_id", limit: 4 | |
|
103 | + t.string "ip_address", limit: 255 | |
|
100 | 104 | t.datetime "created_at" |
|
101 | 105 | t.datetime "updated_at" |
|
102 | - t.string "status" | |
|
103 | - t.index ["updated_at"], name: "index_heart_beats_on_updated_at" | |
|
106 | + t.string "status", limit: 255 | |
|
104 | 107 | end |
|
105 | 108 | |
|
106 | - create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
109 | + add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree | |
|
110 | + | |
|
111 | + create_table "languages", force: :cascade do |t| | |
|
107 | 112 | t.string "name", limit: 10 |
|
108 | - t.string "pretty_name" | |
|
113 | + t.string "pretty_name", limit: 255 | |
|
109 | 114 | t.string "ext", limit: 10 |
|
110 | - t.string "common_ext" | |
|
115 | + t.string "common_ext", limit: 255 | |
|
111 | 116 | end |
|
112 | 117 | |
|
113 | - create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
114 | - t.integer "user_id" | |
|
115 | - t.string "ip_address" | |
|
118 | + create_table "logins", force: :cascade do |t| | |
|
119 | + t.integer "user_id", limit: 4 | |
|
120 | + t.string "ip_address", limit: 255 | |
|
116 | 121 | t.datetime "created_at" |
|
117 | 122 | t.datetime "updated_at" |
|
118 | 123 | end |
|
119 | 124 | |
|
120 |
- create_table "messages |
|
|
121 | - t.integer "sender_id" | |
|
122 | - t.integer "receiver_id" | |
|
123 | - t.integer "replying_message_id" | |
|
124 | - t.text "body" | |
|
125 | + create_table "messages", force: :cascade do |t| | |
|
126 | + t.integer "sender_id", limit: 4 | |
|
127 | + t.integer "receiver_id", limit: 4 | |
|
128 | + t.integer "replying_message_id", limit: 4 | |
|
129 | + t.text "body", limit: 65535 | |
|
125 | 130 | t.boolean "replied" |
|
126 | 131 | t.datetime "created_at" |
|
127 | 132 | t.datetime "updated_at" |
|
128 | 133 | end |
|
129 | 134 | |
|
130 |
- create_table "problems |
|
|
135 | + create_table "problems", force: :cascade do |t| | |
|
131 | 136 | t.string "name", limit: 30 |
|
132 | - t.string "full_name" | |
|
133 | - t.integer "full_score" | |
|
137 | + t.string "full_name", limit: 255 | |
|
138 | + t.integer "full_score", limit: 4 | |
|
134 | 139 | t.date "date_added" |
|
135 | 140 | t.boolean "available" |
|
136 | - t.string "url" | |
|
137 | - t.integer "description_id" | |
|
141 | + t.string "url", limit: 255 | |
|
142 | + t.integer "description_id", limit: 4 | |
|
138 | 143 | t.boolean "test_allowed" |
|
139 | 144 | t.boolean "output_only" |
|
140 | - t.string "description_filename" | |
|
145 | + t.string "description_filename", limit: 255 | |
|
141 | 146 | t.boolean "view_testcase" |
|
142 | 147 | end |
|
143 | 148 | |
|
144 |
- create_table "problems_tags |
|
|
145 | - t.integer "problem_id" | |
|
146 | - t.integer "tag_id" | |
|
147 | - t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true | |
|
148 | - t.index ["problem_id"], name: "index_problems_tags_on_problem_id" | |
|
149 | - t.index ["tag_id"], name: "index_problems_tags_on_tag_id" | |
|
149 | + create_table "problems_tags", force: :cascade do |t| | |
|
150 | + t.integer "problem_id", limit: 4 | |
|
151 | + t.integer "tag_id", limit: 4 | |
|
150 | 152 | end |
|
151 | 153 | |
|
152 | - create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
153 | - t.string "name" | |
|
154 | - t.string "controller" | |
|
155 | - t.string "action" | |
|
154 | + add_index "problems_tags", ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true, using: :btree | |
|
155 | + add_index "problems_tags", ["problem_id"], name: "index_problems_tags_on_problem_id", using: :btree | |
|
156 | + add_index "problems_tags", ["tag_id"], name: "index_problems_tags_on_tag_id", using: :btree | |
|
157 | + | |
|
158 | + create_table "rights", force: :cascade do |t| | |
|
159 | + t.string "name", limit: 255 | |
|
160 | + t.string "controller", limit: 255 | |
|
161 | + t.string "action", limit: 255 | |
|
156 | 162 | end |
|
157 | 163 | |
|
158 |
- create_table "rights_roles", id: false, |
|
|
159 | - t.integer "right_id" | |
|
160 | - t.integer "role_id" | |
|
161 | - t.index ["role_id"], name: "index_rights_roles_on_role_id" | |
|
164 | + create_table "rights_roles", id: false, force: :cascade do |t| | |
|
165 | + t.integer "right_id", limit: 4 | |
|
166 | + t.integer "role_id", limit: 4 | |
|
162 | 167 | end |
|
163 | 168 | |
|
164 | - create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
165 | - t.string "name" | |
|
169 | + add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree | |
|
170 | + | |
|
171 | + create_table "roles", force: :cascade do |t| | |
|
172 | + t.string "name", limit: 255 | |
|
166 | 173 | end |
|
167 | 174 | |
|
168 |
- create_table "roles_users", id: false, |
|
|
169 | - t.integer "role_id" | |
|
170 | - t.integer "user_id" | |
|
171 | - t.index ["user_id"], name: "index_roles_users_on_user_id" | |
|
175 | + create_table "roles_users", id: false, force: :cascade do |t| | |
|
176 | + t.integer "role_id", limit: 4 | |
|
177 | + t.integer "user_id", limit: 4 | |
|
172 | 178 | end |
|
173 | 179 | |
|
174 | - create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
175 | - t.string "session_id" | |
|
176 | - t.text "data" | |
|
180 | + add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree | |
|
181 | + | |
|
182 | + create_table "sessions", force: :cascade do |t| | |
|
183 | + t.string "session_id", limit: 255 | |
|
184 | + t.text "data", limit: 65535 | |
|
177 | 185 | t.datetime "updated_at" |
|
178 | - t.index ["session_id"], name: "index_sessions_on_session_id" | |
|
179 | - t.index ["updated_at"], name: "index_sessions_on_updated_at" | |
|
180 | 186 | end |
|
181 | 187 | |
|
182 | - create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
183 | - t.string "name" | |
|
188 | + add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree | |
|
189 | + add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree | |
|
190 | + | |
|
191 | + create_table "sites", force: :cascade do |t| | |
|
192 | + t.string "name", limit: 255 | |
|
184 | 193 | t.boolean "started" |
|
185 | 194 | t.datetime "start_time" |
|
186 | 195 | t.datetime "created_at" |
|
187 | 196 | t.datetime "updated_at" |
|
188 | - t.integer "country_id" | |
|
189 | - t.string "password" | |
|
197 | + t.integer "country_id", limit: 4 | |
|
198 | + t.string "password", limit: 255 | |
|
190 | 199 | end |
|
191 | 200 | |
|
192 |
- create_table "submission_view_logs |
|
|
193 | - t.integer "user_id" | |
|
194 | - t.integer "submission_id" | |
|
201 | + create_table "submission_view_logs", force: :cascade do |t| | |
|
202 | + t.integer "user_id", limit: 4 | |
|
203 | + t.integer "submission_id", limit: 4 | |
|
195 | 204 | t.datetime "created_at" |
|
196 | 205 | t.datetime "updated_at" |
|
197 | 206 | end |
|
198 | 207 | |
|
199 |
- create_table "submissions |
|
|
200 | - t.integer "user_id" | |
|
201 | - t.integer "problem_id" | |
|
202 | - t.integer "language_id" | |
|
208 | + create_table "submissions", force: :cascade do |t| | |
|
209 | + t.integer "user_id", limit: 4 | |
|
210 | + t.integer "problem_id", limit: 4 | |
|
211 | + t.integer "language_id", limit: 4 | |
|
203 | 212 | t.text "source", limit: 16777215 |
|
204 | - t.binary "binary" | |
|
213 | + t.binary "binary", limit: 65535 | |
|
205 | 214 | t.datetime "submitted_at" |
|
206 | 215 | t.datetime "compiled_at" |
|
207 | - t.text "compiler_message" | |
|
216 | + t.text "compiler_message", limit: 65535 | |
|
208 | 217 | t.datetime "graded_at" |
|
209 | - t.integer "points" | |
|
210 | - t.text "grader_comment" | |
|
211 | - t.integer "number" | |
|
212 | - t.string "source_filename" | |
|
213 | - t.float "max_runtime" | |
|
214 | - t.integer "peak_memory" | |
|
215 | - t.integer "effective_code_length" | |
|
216 | - t.string "ip_address" | |
|
217 | - t.index ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true | |
|
218 | - t.index ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id" | |
|
218 | + t.integer "points", limit: 4 | |
|
219 | + t.text "grader_comment", limit: 65535 | |
|
220 | + t.integer "number", limit: 4 | |
|
221 | + t.string "source_filename", limit: 255 | |
|
222 | + t.float "max_runtime", limit: 24 | |
|
223 | + t.integer "peak_memory", limit: 4 | |
|
224 | + t.integer "effective_code_length", limit: 4 | |
|
225 | + t.string "ip_address", limit: 255 | |
|
219 | 226 | end |
|
220 | 227 | |
|
221 | - create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
222 | - t.string "name", null: false | |
|
223 | - t.text "description" | |
|
228 | + add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree | |
|
229 | + add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree | |
|
230 | + | |
|
231 | + create_table "tags", force: :cascade do |t| | |
|
232 | + t.string "name", limit: 255, null: false | |
|
233 | + t.text "description", limit: 65535 | |
|
224 | 234 | t.boolean "public" |
|
225 | 235 | t.datetime "created_at", null: false |
|
226 | 236 | t.datetime "updated_at", null: false |
|
227 | 237 | end |
|
228 | 238 | |
|
229 | - create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
230 | - t.integer "submission_id" | |
|
239 | + create_table "tasks", force: :cascade do |t| | |
|
240 | + t.integer "submission_id", limit: 4 | |
|
231 | 241 | t.datetime "created_at" |
|
232 | - t.integer "status" | |
|
242 | + t.integer "status", limit: 4 | |
|
233 | 243 | t.datetime "updated_at" |
|
234 | - t.index ["submission_id"], name: "index_tasks_on_submission_id" | |
|
235 | 244 | end |
|
236 | 245 | |
|
237 | - create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
238 | - t.integer "problem_id" | |
|
246 | + add_index "tasks", ["submission_id"], name: "index_tasks_on_submission_id", using: :btree | |
|
247 | + | |
|
248 | + create_table "test_pairs", force: :cascade do |t| | |
|
249 | + t.integer "problem_id", limit: 4 | |
|
239 | 250 | t.text "input", limit: 16777215 |
|
240 | 251 | t.text "solution", limit: 16777215 |
|
241 | 252 | t.datetime "created_at" |
|
242 | 253 | t.datetime "updated_at" |
|
243 | 254 | end |
|
244 | 255 | |
|
245 |
- create_table "test_requests |
|
|
246 | - t.integer "user_id" | |
|
247 | - t.integer "problem_id" | |
|
248 | - t.integer "submission_id" | |
|
249 | - t.string "input_file_name" | |
|
250 | - t.string "output_file_name" | |
|
251 | - t.string "running_stat" | |
|
252 | - t.integer "status" | |
|
256 | + create_table "test_requests", force: :cascade do |t| | |
|
257 | + t.integer "user_id", limit: 4 | |
|
258 | + t.integer "problem_id", limit: 4 | |
|
259 | + t.integer "submission_id", limit: 4 | |
|
260 | + t.string "input_file_name", limit: 255 | |
|
261 | + t.string "output_file_name", limit: 255 | |
|
262 | + t.string "running_stat", limit: 255 | |
|
263 | + t.integer "status", limit: 4 | |
|
253 | 264 | t.datetime "updated_at" |
|
254 | 265 | t.datetime "submitted_at" |
|
255 | 266 | t.datetime "compiled_at" |
|
256 | - t.text "compiler_message" | |
|
267 | + t.text "compiler_message", limit: 65535 | |
|
257 | 268 | t.datetime "graded_at" |
|
258 | - t.string "grader_comment" | |
|
269 | + t.string "grader_comment", limit: 255 | |
|
259 | 270 | t.datetime "created_at" |
|
260 | - t.float "running_time" | |
|
261 | - t.string "exit_status" | |
|
262 | - t.integer "memory_usage" | |
|
263 | - t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id" | |
|
271 | + t.float "running_time", limit: 24 | |
|
272 | + t.string "exit_status", limit: 255 | |
|
273 | + t.integer "memory_usage", limit: 4 | |
|
264 | 274 | end |
|
265 | 275 | |
|
266 | - create_table "testcases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
267 | - t.integer "problem_id" | |
|
268 | - t.integer "num" | |
|
269 |
- t.integer |
|
|
270 | - t.integer "score" | |
|
276 | + add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree | |
|
277 | + | |
|
278 | + create_table "testcases", force: :cascade do |t| | |
|
279 | + t.integer "problem_id", limit: 4 | |
|
280 | + t.integer "num", limit: 4 | |
|
281 | + t.integer "group", limit: 4 | |
|
282 | + t.integer "score", limit: 4 | |
|
271 | 283 | t.text "input", limit: 4294967295 |
|
272 | 284 | t.text "sol", limit: 4294967295 |
|
273 | 285 | t.datetime "created_at" |
|
274 | 286 | t.datetime "updated_at" |
|
275 | - t.index ["problem_id"], name: "index_testcases_on_problem_id" | |
|
276 | 287 | end |
|
277 | 288 | |
|
278 | - create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
279 | - t.integer "user_id" | |
|
289 | + add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id", using: :btree | |
|
290 | + | |
|
291 | + create_table "user_contest_stats", force: :cascade do |t| | |
|
292 | + t.integer "user_id", limit: 4 | |
|
280 | 293 | t.datetime "started_at" |
|
281 | 294 | t.datetime "created_at" |
|
282 | 295 | t.datetime "updated_at" |
|
283 | 296 | t.boolean "forced_logout" |
|
284 | 297 | end |
|
285 | 298 | |
|
286 | - create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
299 | + create_table "users", force: :cascade do |t| | |
|
287 | 300 | t.string "login", limit: 50 |
|
288 | - t.string "full_name" | |
|
289 | - t.string "hashed_password" | |
|
301 | + t.string "full_name", limit: 255 | |
|
302 | + t.string "hashed_password", limit: 255 | |
|
290 | 303 | t.string "salt", limit: 5 |
|
291 | - t.string "alias" | |
|
292 | - t.string "email" | |
|
293 | - t.integer "site_id" | |
|
294 | - t.integer "country_id" | |
|
304 | + t.string "alias", limit: 255 | |
|
305 | + t.string "email", limit: 255 | |
|
306 | + t.integer "site_id", limit: 4 | |
|
307 | + t.integer "country_id", limit: 4 | |
|
295 | 308 | t.boolean "activated", default: false |
|
296 | 309 | t.datetime "created_at" |
|
297 | 310 | t.datetime "updated_at" |
|
298 | - t.string "section" | |
|
311 | + t.string "section", limit: 255 | |
|
299 | 312 | t.boolean "enabled", default: true |
|
300 | - t.string "remark" | |
|
301 | - t.string "last_ip" | |
|
302 | - t.index ["login"], name: "index_users_on_login", unique: true | |
|
313 | + t.string "remark", limit: 255 | |
|
314 | + t.string "last_ip", limit: 255 | |
|
303 | 315 | end |
|
304 | 316 | |
|
317 | + add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree | |
|
318 | + | |
|
305 | 319 | add_foreign_key "problems_tags", "problems" |
|
306 | 320 | add_foreign_key "problems_tags", "tags" |
|
307 | 321 | end |
deleted file |
You need to be logged in to leave comments.
Login now