Description:
update max_score / current_score to property use group filter
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r802:d7e158996222 - - 8 files changed: 88 inserted, 79 deleted

@@ -123,14 +123,12
123 jquery-rails (4.3.3)
123 jquery-rails (4.3.3)
124 rails-dom-testing (>= 1, < 3)
124 rails-dom-testing (>= 1, < 3)
125 railties (>= 4.2.0)
125 railties (>= 4.2.0)
126 thor (>= 0.14, < 2.0)
126 thor (>= 0.14, < 2.0)
127 jquery-tablesorter (1.26.1)
127 jquery-tablesorter (1.26.1)
128 railties (>= 3.2, < 6)
128 railties (>= 3.2, < 6)
129 - jquery-timepicker-addon-rails (1.4.1)
130 - railties (>= 3.1)
131 jquery-ui-rails (6.0.1)
129 jquery-ui-rails (6.0.1)
132 railties (>= 3.2.16)
130 railties (>= 3.2.16)
133 listen (3.1.5)
131 listen (3.1.5)
134 rb-fsevent (~> 0.9, >= 0.9.4)
132 rb-fsevent (~> 0.9, >= 0.9.4)
135 rb-inotify (~> 0.9, >= 0.9.7)
133 rb-inotify (~> 0.9, >= 0.9.7)
136 ruby_dep (~> 1.2)
134 ruby_dep (~> 1.2)
@@ -282,13 +280,12
282 haml-rails
280 haml-rails
283 in_place_editing
281 in_place_editing
284 jbuilder (~> 2.5)
282 jbuilder (~> 2.5)
285 jquery-countdown-rails
283 jquery-countdown-rails
286 jquery-rails
284 jquery-rails
287 jquery-tablesorter
285 jquery-tablesorter
288 - jquery-timepicker-addon-rails
289 jquery-ui-rails
286 jquery-ui-rails
290 listen (>= 3.0.5, < 3.2)
287 listen (>= 3.0.5, < 3.2)
291 mail
288 mail
292 minitest-reporters
289 minitest-reporters
293 momentjs-rails (>= 2.9.0)
290 momentjs-rails (>= 2.9.0)
294 mysql2
291 mysql2
@@ -70,13 +70,13
70 @submission.language = language
70 @submission.language = language
71 end
71 end
72
72
73 @submission.submitted_at = Time.new.gmtime
73 @submission.submitted_at = Time.new.gmtime
74 @submission.ip_address = request.remote_ip
74 @submission.ip_address = request.remote_ip
75
75
76 - if GraderConfiguration.time_limit_mode? and user.contest_finished?
76 + if @current_user.admin? == false && GraderConfiguration.time_limit_mode? && @current_user.contest_finished?
77 @submission.errors.add(:base,"The contest is over.")
77 @submission.errors.add(:base,"The contest is over.")
78 prepare_list_information
78 prepare_list_information
79 render :action => 'list' and return
79 render :action => 'list' and return
80 end
80 end
81
81
82 if @submission.valid?(@current_user)
82 if @submission.valid?(@current_user)
@@ -16,13 +16,13
16
16
17 def max_score
17 def max_score
18 end
18 end
19
19
20 def current_score
20 def current_score
21 @problems = Problem.available_problems
21 @problems = Problem.available_problems
22 - if params[:group_id]
22 + if params[:group_id] && params[:users] == 'group'
23 @group = Group.find(params[:group_id])
23 @group = Group.find(params[:group_id])
24 @users = @group.users.where(enabled: true)
24 @users = @group.users.where(enabled: true)
25 else
25 else
26 @users = User.includes(:contests).includes(:contest_stat).where(enabled: true)
26 @users = User.includes(:contests).includes(:contest_stat).where(enabled: true)
27 end
27 end
28 @scorearray = calculate_max_score(@problems, @users,0,0,true)
28 @scorearray = calculate_max_score(@problems, @users,0,0,true)
@@ -47,16 +47,18
47 pid = Problem.find_by_id(id.to_i)
47 pid = Problem.find_by_id(id.to_i)
48 @problems << pid if pid
48 @problems << pid if pid
49 end
49 end
50 end
50 end
51
51
52 #users
52 #users
53 - @users = if params[:users] == "all" then
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 User.includes(:contests).includes(:contest_stat)
58 User.includes(:contests).includes(:contest_stat)
55 - else
56 - User.includes(:contests).includes(:contest_stat).where(enabled: true)
57 end
59 end
58
60
59 #set up range from param
61 #set up range from param
60 @since_id = params.fetch(:from_id, 0).to_i
62 @since_id = params.fetch(:from_id, 0).to_i
61 @until_id = params.fetch(:to_id, 0).to_i
63 @until_id = params.fetch(:to_id, 0).to_i
62 @since_id = nil if @since_id == 0
64 @since_id = nil if @since_id == 0
@@ -92,13 +92,13
92
92
93 protected
93 protected
94
94
95 def submission_authorization
95 def submission_authorization
96 #admin always has privileged
96 #admin always has privileged
97 return true if @current_user.admin?
97 return true if @current_user.admin?
98 - return true if @current_user.has_role?('TA') && (['show','download'].include? action_name)
98 + return true if @current_user.has_role?('ta') && (['show','download'].include? action_name)
99
99
100 sub = Submission.find(params[:id])
100 sub = Submission.find(params[:id])
101 if @current_user.available_problems.include? sub.problem
101 if @current_user.available_problems.include? sub.problem
102 return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user
102 return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user
103 end
103 end
104
104
@@ -1,11 +1,15
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 + .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 = select_tag "group_id", options_from_collection_for_select( Group.all, 'id','name',params[:group_id]), id: 'group_name',class: 'select2', style: 'width: 20em';
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 = submit_tag 'Apply',class: 'btn btn-default'
12 = submit_tag 'Apply',class: 'btn btn-default'
7
13
8 %br
14 %br
9 -
10 -
11 = render "score_table"
15 = render "score_table"
@@ -36,12 +36,17
36 = radio_button_tag 'users', 'all', (params[:users] == "all")
36 = radio_button_tag 'users', 'all', (params[:users] == "all")
37 All users
37 All users
38 .radio
38 .radio
39 %label
39 %label
40 = radio_button_tag 'users', 'enabled', (params[:users] == "enabled")
40 = radio_button_tag 'users', 'enabled', (params[:users] == "enabled")
41 Only enabled users
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 .row
47 .row
43 .col-md-12
48 .col-md-12
44 = button_tag 'Show', class: "btn btn-primary btn-large", value: "show"
49 = button_tag 'Show', class: "btn btn-primary btn-large", value: "show"
45 = button_tag 'Download CSV', class: "btn btn-primary btn-large", value: "download"
50 = button_tag 'Download CSV', class: "btn btn-primary btn-large", value: "download"
46
51
47 - if @scorearray
52 - if @scorearray
@@ -7,82 +7,83
7 # system, you should be using db:schema:load, not running all the migrations
7 # system, you should be using db:schema:load, not running all the migrations
8 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
8 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 # you'll amass, the slower it'll run and the greater likelihood for issues).
9 # you'll amass, the slower it'll run and the greater likelihood for issues).
10 #
10 #
11 # It's strongly recommended that you check this file into your version control system.
11 # It's strongly recommended that you check this file into your version control system.
12
12
13 - ActiveRecord::Schema.define(version: 2020_04_05_112919) do
13 + ActiveRecord::Schema.define(version: 2020_08_13_083020) do
14
14
15 - create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
15 + create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
16 t.string "author"
16 t.string "author"
17 - t.text "body", limit: 16777215
17 + t.text "body"
18 t.boolean "published"
18 t.boolean "published"
19 - t.datetime "created_at", null: false
19 + t.datetime "created_at"
20 - t.datetime "updated_at", null: false
20 + t.datetime "updated_at"
21 t.boolean "frontpage", default: false
21 t.boolean "frontpage", default: false
22 t.boolean "contest_only", default: false
22 t.boolean "contest_only", default: false
23 t.string "title"
23 t.string "title"
24 t.string "notes"
24 t.string "notes"
25 end
25 end
26
26
27 - create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
27 + create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
28 t.string "title"
28 t.string "title"
29 t.boolean "enabled"
29 t.boolean "enabled"
30 - t.datetime "created_at", null: false
30 + t.datetime "created_at"
31 - t.datetime "updated_at", null: false
31 + t.datetime "updated_at"
32 t.string "name"
32 t.string "name"
33 end
33 end
34
34
35 - create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
35 + create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
36 t.integer "contest_id"
36 t.integer "contest_id"
37 t.integer "problem_id"
37 t.integer "problem_id"
38 end
38 end
39
39
40 - create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
40 + create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
41 t.integer "contest_id"
41 t.integer "contest_id"
42 t.integer "user_id"
42 t.integer "user_id"
43 end
43 end
44
44
45 - create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
45 + create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
46 t.string "name"
46 t.string "name"
47 - t.datetime "created_at", null: false
47 + t.datetime "created_at"
48 - t.datetime "updated_at", null: false
48 + t.datetime "updated_at"
49 end
49 end
50
50
51 - create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
51 + create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
52 - t.text "body", limit: 16777215
52 + t.text "body"
53 t.boolean "markdowned"
53 t.boolean "markdowned"
54 - t.datetime "created_at", null: false
54 + t.datetime "created_at"
55 - t.datetime "updated_at", null: false
55 + t.datetime "updated_at"
56 end
56 end
57
57
58 - create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
58 + create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
59 t.string "key"
59 t.string "key"
60 t.string "value_type"
60 t.string "value_type"
61 t.string "value"
61 t.string "value"
62 - t.datetime "created_at", null: false
62 + t.datetime "created_at"
63 - t.datetime "updated_at", null: false
63 + t.datetime "updated_at"
64 - t.text "description", limit: 16777215
64 + t.text "description"
65 end
65 end
66
66
67 - create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
67 + create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
68 t.string "host"
68 t.string "host"
69 t.integer "pid"
69 t.integer "pid"
70 t.string "mode"
70 t.string "mode"
71 t.boolean "active"
71 t.boolean "active"
72 - t.datetime "created_at", null: false
72 + t.datetime "created_at"
73 - t.datetime "updated_at", null: false
73 + t.datetime "updated_at"
74 t.integer "task_id"
74 t.integer "task_id"
75 t.string "task_type"
75 t.string "task_type"
76 t.boolean "terminated"
76 t.boolean "terminated"
77 - t.index ["host", "pid"], name: "index_grader_processes_on_ip_and_pid"
77 + t.index ["host", "pid"], name: "index_grader_processes_on_host_and_pid"
78 end
78 end
79
79
80 create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
80 create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
81 t.string "name"
81 t.string "name"
82 t.string "description"
82 t.string "description"
83 + t.boolean "enabled", default: true
83 end
84 end
84
85
85 create_table "groups_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
86 create_table "groups_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
86 t.integer "problem_id", null: false
87 t.integer "problem_id", null: false
87 t.integer "group_id", null: false
88 t.integer "group_id", null: false
88 t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id"
89 t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id"
@@ -94,45 +95,45
94 t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id"
95 t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id"
95 end
96 end
96
97
97 create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
98 create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
98 t.integer "user_id"
99 t.integer "user_id"
99 t.string "ip_address"
100 t.string "ip_address"
100 - t.datetime "created_at", null: false
101 + t.datetime "created_at"
101 - t.datetime "updated_at", null: false
102 + t.datetime "updated_at"
102 t.string "status"
103 t.string "status"
103 t.index ["updated_at"], name: "index_heart_beats_on_updated_at"
104 t.index ["updated_at"], name: "index_heart_beats_on_updated_at"
104 end
105 end
105
106
106 - create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
107 + create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
107 t.string "name", limit: 10
108 t.string "name", limit: 10
108 t.string "pretty_name"
109 t.string "pretty_name"
109 t.string "ext", limit: 10
110 t.string "ext", limit: 10
110 t.string "common_ext"
111 t.string "common_ext"
111 end
112 end
112
113
113 create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
114 create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
114 t.integer "user_id"
115 t.integer "user_id"
115 t.string "ip_address"
116 t.string "ip_address"
116 - t.datetime "created_at", null: false
117 + t.datetime "created_at"
117 - t.datetime "updated_at", null: false
118 + t.datetime "updated_at"
118 t.index ["user_id"], name: "index_logins_on_user_id"
119 t.index ["user_id"], name: "index_logins_on_user_id"
119 end
120 end
120
121
121 - create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
122 + create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
122 t.integer "sender_id"
123 t.integer "sender_id"
123 t.integer "receiver_id"
124 t.integer "receiver_id"
124 t.integer "replying_message_id"
125 t.integer "replying_message_id"
125 - t.text "body", limit: 16777215
126 + t.text "body"
126 t.boolean "replied"
127 t.boolean "replied"
127 - t.datetime "created_at", null: false
128 + t.datetime "created_at"
128 - t.datetime "updated_at", null: false
129 + t.datetime "updated_at"
129 end
130 end
130
131
131 - create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
132 + create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
132 - t.string "name", limit: 100
133 + t.string "name", limit: 30
133 t.string "full_name"
134 t.string "full_name"
134 t.integer "full_score"
135 t.integer "full_score"
135 t.date "date_added"
136 t.date "date_added"
136 t.boolean "available"
137 t.boolean "available"
137 t.string "url"
138 t.string "url"
138 t.integer "description_id"
139 t.integer "description_id"
@@ -147,71 +148,71
147 t.integer "tag_id"
148 t.integer "tag_id"
148 t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true
149 t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true
149 t.index ["problem_id"], name: "index_problems_tags_on_problem_id"
150 t.index ["problem_id"], name: "index_problems_tags_on_problem_id"
150 t.index ["tag_id"], name: "index_problems_tags_on_tag_id"
151 t.index ["tag_id"], name: "index_problems_tags_on_tag_id"
151 end
152 end
152
153
153 - create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
154 + create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
154 t.string "name"
155 t.string "name"
155 t.string "controller"
156 t.string "controller"
156 t.string "action"
157 t.string "action"
157 end
158 end
158
159
159 - create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
160 + create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
160 t.integer "right_id"
161 t.integer "right_id"
161 t.integer "role_id"
162 t.integer "role_id"
162 t.index ["role_id"], name: "index_rights_roles_on_role_id"
163 t.index ["role_id"], name: "index_rights_roles_on_role_id"
163 end
164 end
164
165
165 - create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
166 + create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
166 t.string "name"
167 t.string "name"
167 end
168 end
168
169
169 - create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
170 + create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
170 t.integer "role_id"
171 t.integer "role_id"
171 t.integer "user_id"
172 t.integer "user_id"
172 t.index ["user_id"], name: "index_roles_users_on_user_id"
173 t.index ["user_id"], name: "index_roles_users_on_user_id"
173 end
174 end
174
175
175 - create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
176 + create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
176 t.string "session_id"
177 t.string "session_id"
177 - t.text "data", limit: 16777215
178 + t.text "data"
178 t.datetime "updated_at"
179 t.datetime "updated_at"
179 t.index ["session_id"], name: "index_sessions_on_session_id"
180 t.index ["session_id"], name: "index_sessions_on_session_id"
180 t.index ["updated_at"], name: "index_sessions_on_updated_at"
181 t.index ["updated_at"], name: "index_sessions_on_updated_at"
181 end
182 end
182
183
183 - create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
184 + create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
184 t.string "name"
185 t.string "name"
185 t.boolean "started"
186 t.boolean "started"
186 t.datetime "start_time"
187 t.datetime "start_time"
187 - t.datetime "created_at", null: false
188 + t.datetime "created_at"
188 - t.datetime "updated_at", null: false
189 + t.datetime "updated_at"
189 t.integer "country_id"
190 t.integer "country_id"
190 t.string "password"
191 t.string "password"
191 end
192 end
192
193
193 create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
194 create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
194 t.integer "user_id"
195 t.integer "user_id"
195 t.integer "submission_id"
196 t.integer "submission_id"
196 - t.datetime "created_at", null: false
197 + t.datetime "created_at"
197 - t.datetime "updated_at", null: false
198 + t.datetime "updated_at"
198 end
199 end
199
200
200 - create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
201 + create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
201 t.integer "user_id"
202 t.integer "user_id"
202 t.integer "problem_id"
203 t.integer "problem_id"
203 t.integer "language_id"
204 t.integer "language_id"
204 t.text "source", limit: 16777215
205 t.text "source", limit: 16777215
205 t.binary "binary"
206 t.binary "binary"
206 t.datetime "submitted_at"
207 t.datetime "submitted_at"
207 t.datetime "compiled_at"
208 t.datetime "compiled_at"
208 - t.text "compiler_message", limit: 16777215
209 + t.text "compiler_message"
209 t.datetime "graded_at"
210 t.datetime "graded_at"
210 t.integer "points"
211 t.integer "points"
211 - t.text "grader_comment", limit: 16777215
212 + t.text "grader_comment"
212 t.integer "number"
213 t.integer "number"
213 t.string "source_filename"
214 t.string "source_filename"
214 t.float "max_runtime"
215 t.float "max_runtime"
215 t.integer "peak_memory"
216 t.integer "peak_memory"
216 t.integer "effective_code_length"
217 t.integer "effective_code_length"
217 t.string "ip_address"
218 t.string "ip_address"
@@ -225,43 +226,43
225 t.text "description"
226 t.text "description"
226 t.boolean "public"
227 t.boolean "public"
227 t.datetime "created_at", null: false
228 t.datetime "created_at", null: false
228 t.datetime "updated_at", null: false
229 t.datetime "updated_at", null: false
229 end
230 end
230
231
231 - create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
232 + create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
232 t.integer "submission_id"
233 t.integer "submission_id"
233 t.datetime "created_at"
234 t.datetime "created_at"
234 t.integer "status"
235 t.integer "status"
235 t.datetime "updated_at"
236 t.datetime "updated_at"
236 t.index ["submission_id"], name: "index_tasks_on_submission_id"
237 t.index ["submission_id"], name: "index_tasks_on_submission_id"
237 end
238 end
238
239
239 - create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
240 + create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
240 t.integer "problem_id"
241 t.integer "problem_id"
241 - t.text "input", limit: 4294967295
242 + t.text "input", limit: 16777215
242 - t.text "solution", limit: 4294967295
243 + t.text "solution", limit: 16777215
243 - t.datetime "created_at", null: false
244 + t.datetime "created_at"
244 - t.datetime "updated_at", null: false
245 + t.datetime "updated_at"
245 end
246 end
246
247
247 - create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
248 + create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
248 t.integer "user_id"
249 t.integer "user_id"
249 t.integer "problem_id"
250 t.integer "problem_id"
250 t.integer "submission_id"
251 t.integer "submission_id"
251 t.string "input_file_name"
252 t.string "input_file_name"
252 t.string "output_file_name"
253 t.string "output_file_name"
253 t.string "running_stat"
254 t.string "running_stat"
254 t.integer "status"
255 t.integer "status"
255 - t.datetime "updated_at", null: false
256 + t.datetime "updated_at"
256 t.datetime "submitted_at"
257 t.datetime "submitted_at"
257 t.datetime "compiled_at"
258 t.datetime "compiled_at"
258 - t.text "compiler_message", limit: 16777215
259 + t.text "compiler_message"
259 t.datetime "graded_at"
260 t.datetime "graded_at"
260 t.string "grader_comment"
261 t.string "grader_comment"
261 - t.datetime "created_at", null: false
262 + t.datetime "created_at"
262 t.float "running_time"
263 t.float "running_time"
263 t.string "exit_status"
264 t.string "exit_status"
264 t.integer "memory_usage"
265 t.integer "memory_usage"
265 t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id"
266 t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id"
266 end
267 end
267
268
@@ -269,26 +270,26
269 t.integer "problem_id"
270 t.integer "problem_id"
270 t.integer "num"
271 t.integer "num"
271 t.integer "group"
272 t.integer "group"
272 t.integer "score"
273 t.integer "score"
273 t.text "input", limit: 4294967295
274 t.text "input", limit: 4294967295
274 t.text "sol", limit: 4294967295
275 t.text "sol", limit: 4294967295
275 - t.datetime "created_at", null: false
276 + t.datetime "created_at"
276 - t.datetime "updated_at", null: false
277 + t.datetime "updated_at"
277 t.index ["problem_id"], name: "index_testcases_on_problem_id"
278 t.index ["problem_id"], name: "index_testcases_on_problem_id"
278 end
279 end
279
280
280 - create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
281 + create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
281 t.integer "user_id"
282 t.integer "user_id"
282 t.datetime "started_at"
283 t.datetime "started_at"
283 - t.datetime "created_at", null: false
284 + t.datetime "created_at"
284 - t.datetime "updated_at", null: false
285 + t.datetime "updated_at"
285 t.boolean "forced_logout"
286 t.boolean "forced_logout"
286 end
287 end
287
288
288 - create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
289 + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
289 t.string "login", limit: 50
290 t.string "login", limit: 50
290 t.string "full_name"
291 t.string "full_name"
291 t.string "hashed_password"
292 t.string "hashed_password"
292 t.string "salt", limit: 5
293 t.string "salt", limit: 5
293 t.string "alias"
294 t.string "alias"
294 t.string "email"
295 t.string "email"
@@ -222,13 +222,13
222 conf[:default_value],
222 conf[:default_value],
223 desc)
223 desc)
224 end
224 end
225 end
225 end
226
226
227 def seed_roles
227 def seed_roles
228 - Role.find_or_create_by(name: 'TA')
228 + Role.find_or_create_by(name: 'ta')
229 return if Role.find_by_name('admin')
229 return if Role.find_by_name('admin')
230
230
231 role = Role.create(:name => 'admin')
231 role = Role.create(:name => 'admin')
232 user_admin_right = Right.create(:name => 'user_admin',
232 user_admin_right = Right.create(:name => 'user_admin',
233 :controller => 'user_admin',
233 :controller => 'user_admin',
234 :action => 'all')
234 :action => 'all')
You need to be logged in to leave comments. Login now