Description:
update max_score / current_score to property use group filter
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r802:d7e158996222 - - 8 files changed: 88 inserted, 79 deleted
@@ -126,8 +126,6 | |||
|
126 | 126 | thor (>= 0.14, < 2.0) |
|
127 | 127 | jquery-tablesorter (1.26.1) |
|
128 | 128 | railties (>= 3.2, < 6) |
|
129 | - jquery-timepicker-addon-rails (1.4.1) | |
|
130 | - railties (>= 3.1) | |
|
131 | 129 | jquery-ui-rails (6.0.1) |
|
132 | 130 | railties (>= 3.2.16) |
|
133 | 131 | listen (3.1.5) |
@@ -285,7 +283,6 | |||
|
285 | 283 | jquery-countdown-rails |
|
286 | 284 | jquery-rails |
|
287 | 285 | jquery-tablesorter |
|
288 | - jquery-timepicker-addon-rails | |
|
289 | 286 | jquery-ui-rails |
|
290 | 287 | listen (>= 3.0.5, < 3.2) |
|
291 | 288 |
@@ -73,7 +73,7 | |||
|
73 | 73 | @submission.submitted_at = Time.new.gmtime |
|
74 | 74 | @submission.ip_address = request.remote_ip |
|
75 | 75 | |
|
76 |
- if GraderConfiguration.time_limit_mode? |
|
|
76 | + if @current_user.admin? == false && GraderConfiguration.time_limit_mode? && @current_user.contest_finished? | |
|
77 | 77 | @submission.errors.add(:base,"The contest is over.") |
|
78 | 78 | prepare_list_information |
|
79 | 79 | render :action => 'list' and return |
@@ -19,7 +19,7 | |||
|
19 | 19 | |
|
20 | 20 | def current_score |
|
21 | 21 | @problems = Problem.available_problems |
|
22 | - if params[:group_id] | |
|
22 | + if params[:group_id] && params[:users] == 'group' | |
|
23 | 23 | @group = Group.find(params[:group_id]) |
|
24 | 24 | @users = @group.users.where(enabled: true) |
|
25 | 25 | else |
@@ -50,10 +50,12 | |||
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | #users |
|
53 |
- @users = if params[:users] == " |
|
|
53 | + @users = if params[:users] == "group" then | |
|
54 | + Group.find(params[:group_id]).users.all | |
|
55 | + elsif params[:users] == 'enabled' | |
|
56 | + User.includes(:contests).includes(:contest_stat).where(enabled: true) | |
|
57 | + else | |
|
54 | 58 | User.includes(:contests).includes(:contest_stat) |
|
55 | - else | |
|
56 | - User.includes(:contests).includes(:contest_stat).where(enabled: true) | |
|
57 | 59 | end |
|
58 | 60 | |
|
59 | 61 | #set up range from param |
@@ -95,7 +95,7 | |||
|
95 | 95 | def submission_authorization |
|
96 | 96 | #admin always has privileged |
|
97 | 97 | return true if @current_user.admin? |
|
98 |
- return true if @current_user.has_role?(' |
|
|
98 | + return true if @current_user.has_role?('ta') && (['show','download'].include? action_name) | |
|
99 | 99 | |
|
100 | 100 | sub = Submission.find(params[:id]) |
|
101 | 101 | if @current_user.available_problems.include? sub.problem |
@@ -1,11 +1,15 | |||
|
1 | 1 | .container-fluid |
|
2 | 2 | %h1 Current Score |
|
3 | 3 | = form_tag current_score_report_path, method: 'get' do |
|
4 | - Show only users from this group | |
|
4 | + .radio-inline | |
|
5 | + = radio_button_tag 'users', 'all', (params[:users] == 'all') | |
|
6 | + = label_tag(:users_all,'Show all users') | |
|
7 | + %br | |
|
8 | + .radio-inline | |
|
9 | + = radio_button_tag 'users', 'group', (params[:users] == 'group') | |
|
10 | + = label_tag(:users_group, 'Show only users from this group') | |
|
5 | 11 | = 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 | 12 | = submit_tag 'Apply',class: 'btn btn-default' |
|
7 | 13 | |
|
8 | 14 | %br |
|
9 | - | |
|
10 | - | |
|
11 | 15 | = render "score_table" |
@@ -39,6 +39,11 | |||
|
39 | 39 | %label |
|
40 | 40 | = radio_button_tag 'users', 'enabled', (params[:users] == "enabled") |
|
41 | 41 | Only enabled users |
|
42 | + .radio | |
|
43 | + %label | |
|
44 | + = radio_button_tag 'users', 'group', (params[:users] == "group") | |
|
45 | + Only users from this group | |
|
46 | + = select_tag "group_id", options_from_collection_for_select( Group.all, 'id','name',params[:group_id]), id: 'group_name',class: 'select2', style: 'width: 20em'; | |
|
42 | 47 | .row |
|
43 | 48 | .col-md-12 |
|
44 | 49 | = button_tag 'Show', class: "btn btn-primary btn-large", value: "show" |
@@ -10,76 +10,77 | |||
|
10 | 10 | # |
|
11 | 11 | # It's strongly recommended that you check this file into your version control system. |
|
12 | 12 | |
|
13 |
- ActiveRecord::Schema.define(version: 2020_0 |
|
|
13 | + ActiveRecord::Schema.define(version: 2020_08_13_083020) do | |
|
14 | 14 | |
|
15 |
- create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
15 | + create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
16 | 16 | t.string "author" |
|
17 |
- t.text "body" |
|
|
17 | + t.text "body" | |
|
18 | 18 | t.boolean "published" |
|
19 |
- t.datetime "created_at" |
|
|
20 |
- t.datetime "updated_at" |
|
|
19 | + t.datetime "created_at" | |
|
20 | + t.datetime "updated_at" | |
|
21 | 21 | t.boolean "frontpage", default: false |
|
22 | 22 | t.boolean "contest_only", default: false |
|
23 | 23 | t.string "title" |
|
24 | 24 | t.string "notes" |
|
25 | 25 | end |
|
26 | 26 | |
|
27 |
- create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
27 | + create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
28 | 28 | t.string "title" |
|
29 | 29 | t.boolean "enabled" |
|
30 |
- t.datetime "created_at" |
|
|
31 |
- t.datetime "updated_at" |
|
|
30 | + t.datetime "created_at" | |
|
31 | + t.datetime "updated_at" | |
|
32 | 32 | t.string "name" |
|
33 | 33 | end |
|
34 | 34 | |
|
35 |
- create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
35 | + create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
36 | 36 | t.integer "contest_id" |
|
37 | 37 | t.integer "problem_id" |
|
38 | 38 | end |
|
39 | 39 | |
|
40 |
- create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
40 | + create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
41 | 41 | t.integer "contest_id" |
|
42 | 42 | t.integer "user_id" |
|
43 | 43 | end |
|
44 | 44 | |
|
45 |
- create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
45 | + create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
46 | 46 | t.string "name" |
|
47 |
- t.datetime "created_at" |
|
|
48 |
- t.datetime "updated_at" |
|
|
47 | + t.datetime "created_at" | |
|
48 | + t.datetime "updated_at" | |
|
49 | 49 | end |
|
50 | 50 | |
|
51 |
- create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
52 |
- t.text "body" |
|
|
51 | + create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
52 | + t.text "body" | |
|
53 | 53 | t.boolean "markdowned" |
|
54 |
- t.datetime "created_at" |
|
|
55 |
- t.datetime "updated_at" |
|
|
54 | + t.datetime "created_at" | |
|
55 | + t.datetime "updated_at" | |
|
56 | 56 | end |
|
57 | 57 | |
|
58 |
- create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
58 | + create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
59 | 59 | t.string "key" |
|
60 | 60 | t.string "value_type" |
|
61 | 61 | t.string "value" |
|
62 |
- t.datetime "created_at" |
|
|
63 |
- t.datetime "updated_at" |
|
|
64 |
- t.text "description" |
|
|
62 | + t.datetime "created_at" | |
|
63 | + t.datetime "updated_at" | |
|
64 | + t.text "description" | |
|
65 | 65 | end |
|
66 | 66 | |
|
67 |
- create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
67 | + create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
68 | 68 | t.string "host" |
|
69 | 69 | t.integer "pid" |
|
70 | 70 | t.string "mode" |
|
71 | 71 | t.boolean "active" |
|
72 |
- t.datetime "created_at" |
|
|
73 |
- t.datetime "updated_at" |
|
|
72 | + t.datetime "created_at" | |
|
73 | + t.datetime "updated_at" | |
|
74 | 74 | t.integer "task_id" |
|
75 | 75 | t.string "task_type" |
|
76 | 76 | t.boolean "terminated" |
|
77 |
- t.index ["host", "pid"], name: "index_grader_processes_on_ |
|
|
77 | + t.index ["host", "pid"], name: "index_grader_processes_on_host_and_pid" | |
|
78 | 78 | end |
|
79 | 79 | |
|
80 | 80 | create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
81 | 81 | t.string "name" |
|
82 | 82 | t.string "description" |
|
83 | + t.boolean "enabled", default: true | |
|
83 | 84 | end |
|
84 | 85 | |
|
85 | 86 | create_table "groups_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
@@ -97,13 +98,13 | |||
|
97 | 98 | create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
98 | 99 | t.integer "user_id" |
|
99 | 100 | t.string "ip_address" |
|
100 |
- t.datetime "created_at" |
|
|
101 |
- t.datetime "updated_at" |
|
|
101 | + t.datetime "created_at" | |
|
102 | + t.datetime "updated_at" | |
|
102 | 103 | t.string "status" |
|
103 | 104 | t.index ["updated_at"], name: "index_heart_beats_on_updated_at" |
|
104 | 105 | end |
|
105 | 106 | |
|
106 |
- create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
107 | + create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
107 | 108 | t.string "name", limit: 10 |
|
108 | 109 | t.string "pretty_name" |
|
109 | 110 | t.string "ext", limit: 10 |
@@ -113,23 +114,23 | |||
|
113 | 114 | create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
114 | 115 | t.integer "user_id" |
|
115 | 116 | t.string "ip_address" |
|
116 |
- t.datetime "created_at" |
|
|
117 |
- t.datetime "updated_at" |
|
|
117 | + t.datetime "created_at" | |
|
118 | + t.datetime "updated_at" | |
|
118 | 119 | t.index ["user_id"], name: "index_logins_on_user_id" |
|
119 | 120 | end |
|
120 | 121 | |
|
121 |
- create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
122 | + create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
122 | 123 | t.integer "sender_id" |
|
123 | 124 | t.integer "receiver_id" |
|
124 | 125 | t.integer "replying_message_id" |
|
125 |
- t.text "body" |
|
|
126 | + t.text "body" | |
|
126 | 127 | t.boolean "replied" |
|
127 |
- t.datetime "created_at" |
|
|
128 |
- t.datetime "updated_at" |
|
|
128 | + t.datetime "created_at" | |
|
129 | + t.datetime "updated_at" | |
|
129 | 130 | end |
|
130 | 131 | |
|
131 |
- create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
132 |
- t.string "name", limit: |
|
|
132 | + create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
133 | + t.string "name", limit: 30 | |
|
133 | 134 | t.string "full_name" |
|
134 | 135 | t.integer "full_score" |
|
135 | 136 | t.date "date_added" |
@@ -150,42 +151,42 | |||
|
150 | 151 | t.index ["tag_id"], name: "index_problems_tags_on_tag_id" |
|
151 | 152 | end |
|
152 | 153 | |
|
153 |
- create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
154 | + create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
154 | 155 | t.string "name" |
|
155 | 156 | t.string "controller" |
|
156 | 157 | t.string "action" |
|
157 | 158 | end |
|
158 | 159 | |
|
159 |
- create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
160 | + create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
160 | 161 | t.integer "right_id" |
|
161 | 162 | t.integer "role_id" |
|
162 | 163 | t.index ["role_id"], name: "index_rights_roles_on_role_id" |
|
163 | 164 | end |
|
164 | 165 | |
|
165 |
- create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
166 | + create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
166 | 167 | t.string "name" |
|
167 | 168 | end |
|
168 | 169 | |
|
169 |
- create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
170 | + create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
170 | 171 | t.integer "role_id" |
|
171 | 172 | t.integer "user_id" |
|
172 | 173 | t.index ["user_id"], name: "index_roles_users_on_user_id" |
|
173 | 174 | end |
|
174 | 175 | |
|
175 |
- create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
176 | + create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
176 | 177 | t.string "session_id" |
|
177 |
- t.text "data" |
|
|
178 | + t.text "data" | |
|
178 | 179 | t.datetime "updated_at" |
|
179 | 180 | t.index ["session_id"], name: "index_sessions_on_session_id" |
|
180 | 181 | t.index ["updated_at"], name: "index_sessions_on_updated_at" |
|
181 | 182 | end |
|
182 | 183 | |
|
183 |
- create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
184 | + create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
184 | 185 | t.string "name" |
|
185 | 186 | t.boolean "started" |
|
186 | 187 | t.datetime "start_time" |
|
187 |
- t.datetime "created_at" |
|
|
188 |
- t.datetime "updated_at" |
|
|
188 | + t.datetime "created_at" | |
|
189 | + t.datetime "updated_at" | |
|
189 | 190 | t.integer "country_id" |
|
190 | 191 | t.string "password" |
|
191 | 192 | end |
@@ -193,11 +194,11 | |||
|
193 | 194 | create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
194 | 195 | t.integer "user_id" |
|
195 | 196 | t.integer "submission_id" |
|
196 |
- t.datetime "created_at" |
|
|
197 |
- t.datetime "updated_at" |
|
|
197 | + t.datetime "created_at" | |
|
198 | + t.datetime "updated_at" | |
|
198 | 199 | end |
|
199 | 200 | |
|
200 |
- create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
201 | + create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
201 | 202 | t.integer "user_id" |
|
202 | 203 | t.integer "problem_id" |
|
203 | 204 | t.integer "language_id" |
@@ -205,10 +206,10 | |||
|
205 | 206 | t.binary "binary" |
|
206 | 207 | t.datetime "submitted_at" |
|
207 | 208 | t.datetime "compiled_at" |
|
208 |
- t.text "compiler_message" |
|
|
209 | + t.text "compiler_message" | |
|
209 | 210 | t.datetime "graded_at" |
|
210 | 211 | t.integer "points" |
|
211 |
- t.text "grader_comment" |
|
|
212 | + t.text "grader_comment" | |
|
212 | 213 | t.integer "number" |
|
213 | 214 | t.string "source_filename" |
|
214 | 215 | t.float "max_runtime" |
@@ -228,7 +229,7 | |||
|
228 | 229 | t.datetime "updated_at", null: false |
|
229 | 230 | end |
|
230 | 231 | |
|
231 |
- create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
232 | + create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
232 | 233 | t.integer "submission_id" |
|
233 | 234 | t.datetime "created_at" |
|
234 | 235 | t.integer "status" |
@@ -236,15 +237,15 | |||
|
236 | 237 | t.index ["submission_id"], name: "index_tasks_on_submission_id" |
|
237 | 238 | end |
|
238 | 239 | |
|
239 |
- create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
240 | + create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
240 | 241 | t.integer "problem_id" |
|
241 |
- t.text "input", limit: |
|
|
242 |
- t.text "solution", limit: |
|
|
243 |
- t.datetime "created_at" |
|
|
244 |
- t.datetime "updated_at" |
|
|
242 | + t.text "input", limit: 16777215 | |
|
243 | + t.text "solution", limit: 16777215 | |
|
244 | + t.datetime "created_at" | |
|
245 | + t.datetime "updated_at" | |
|
245 | 246 | end |
|
246 | 247 | |
|
247 |
- create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
248 | + create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
248 | 249 | t.integer "user_id" |
|
249 | 250 | t.integer "problem_id" |
|
250 | 251 | t.integer "submission_id" |
@@ -252,13 +253,13 | |||
|
252 | 253 | t.string "output_file_name" |
|
253 | 254 | t.string "running_stat" |
|
254 | 255 | t.integer "status" |
|
255 |
- t.datetime "updated_at" |
|
|
256 | + t.datetime "updated_at" | |
|
256 | 257 | t.datetime "submitted_at" |
|
257 | 258 | t.datetime "compiled_at" |
|
258 |
- t.text "compiler_message" |
|
|
259 | + t.text "compiler_message" | |
|
259 | 260 | t.datetime "graded_at" |
|
260 | 261 | t.string "grader_comment" |
|
261 |
- t.datetime "created_at" |
|
|
262 | + t.datetime "created_at" | |
|
262 | 263 | t.float "running_time" |
|
263 | 264 | t.string "exit_status" |
|
264 | 265 | t.integer "memory_usage" |
@@ -272,20 +273,20 | |||
|
272 | 273 | t.integer "score" |
|
273 | 274 | t.text "input", limit: 4294967295 |
|
274 | 275 | t.text "sol", limit: 4294967295 |
|
275 |
- t.datetime "created_at" |
|
|
276 |
- t.datetime "updated_at" |
|
|
276 | + t.datetime "created_at" | |
|
277 | + t.datetime "updated_at" | |
|
277 | 278 | t.index ["problem_id"], name: "index_testcases_on_problem_id" |
|
278 | 279 | end |
|
279 | 280 | |
|
280 |
- create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
281 | + create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
281 | 282 | t.integer "user_id" |
|
282 | 283 | t.datetime "started_at" |
|
283 |
- t.datetime "created_at" |
|
|
284 |
- t.datetime "updated_at" |
|
|
284 | + t.datetime "created_at" | |
|
285 | + t.datetime "updated_at" | |
|
285 | 286 | t.boolean "forced_logout" |
|
286 | 287 | end |
|
287 | 288 | |
|
288 |
- create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
|
289 | + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| | |
|
289 | 290 | t.string "login", limit: 50 |
|
290 | 291 | t.string "full_name" |
|
291 | 292 | t.string "hashed_password" |
You need to be logged in to leave comments.
Login now