Description:
Merge pull request #23 from nattee/master
some bug fix
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r768:f22301d0d070 - - 7 files changed: 12 inserted, 5 deleted
@@ -0,0 +1,5 | |||
|
1 | + class ChangeSubmissionSourceSize < ActiveRecord::Migration | |
|
2 | + def change | |
|
3 | + change_column :submissions, :source, :text, :limit => 1.megabyte | |
|
4 | + end | |
|
5 | + end |
@@ -142,97 +142,97 | |||
|
142 | 142 | format.js { } |
|
143 | 143 | end |
|
144 | 144 | end |
|
145 | 145 | |
|
146 | 146 | def turn_all_off |
|
147 | 147 | Problem.available.all.each do |problem| |
|
148 | 148 | problem.available = false |
|
149 | 149 | problem.save |
|
150 | 150 | end |
|
151 | 151 | redirect_to action: :index |
|
152 | 152 | end |
|
153 | 153 | |
|
154 | 154 | def turn_all_on |
|
155 | 155 | Problem.where.not(available: true).each do |problem| |
|
156 | 156 | problem.available = true |
|
157 | 157 | problem.save |
|
158 | 158 | end |
|
159 | 159 | redirect_to action: :index |
|
160 | 160 | end |
|
161 | 161 | |
|
162 | 162 | def stat |
|
163 | 163 | @problem = Problem.find(params[:id]) |
|
164 | 164 | unless @problem.available or session[:admin] |
|
165 | 165 | redirect_to :controller => 'main', :action => 'list' |
|
166 | 166 | return |
|
167 | 167 | end |
|
168 | 168 | @submissions = Submission.includes(:user).includes(:language).where(problem_id: params[:id]).order(:user_id,:id) |
|
169 | 169 | |
|
170 | 170 | #stat summary |
|
171 | 171 | range =65 |
|
172 | 172 | @histogram = { data: Array.new(range,0), summary: {} } |
|
173 | 173 | user = Hash.new(0) |
|
174 | 174 | @submissions.find_each do |sub| |
|
175 | 175 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
176 | 176 | @histogram[:data][d.to_i] += 1 if d < range |
|
177 | 177 | user[sub.user_id] = [user[sub.user_id], ((sub.try(:points) || 0) >= @problem.full_score) ? 1 : 0].max |
|
178 | 178 | end |
|
179 | 179 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
180 | 180 | |
|
181 | 181 | @summary = { attempt: user.count, solve: 0 } |
|
182 | 182 | user.each_value { |v| @summary[:solve] += 1 if v == 1 } |
|
183 | 183 | end |
|
184 | 184 | |
|
185 | 185 | def manage |
|
186 | 186 | @problems = Problem.order(date_added: :desc) |
|
187 | 187 | end |
|
188 | 188 | |
|
189 | 189 | def do_manage |
|
190 | - if params.has_key? 'change_date_added' | |
|
190 | + if params.has_key? 'change_date_added' and params[:date_added].strip.empty? == false | |
|
191 | 191 | change_date_added |
|
192 | 192 | elsif params.has_key? 'add_to_contest' |
|
193 | 193 | add_to_contest |
|
194 | 194 | elsif params.has_key? 'enable_problem' |
|
195 | 195 | set_available(true) |
|
196 | 196 | elsif params.has_key? 'disable_problem' |
|
197 | 197 | set_available(false) |
|
198 | 198 | elsif params.has_key? 'add_group' |
|
199 | 199 | group = Group.find(params[:group_id]) |
|
200 | 200 | ok = [] |
|
201 | 201 | failed = [] |
|
202 | 202 | get_problems_from_params.each do |p| |
|
203 | 203 | begin |
|
204 | 204 | group.problems << p |
|
205 | 205 | ok << p.full_name |
|
206 | 206 | rescue => e |
|
207 | 207 | failed << p.full_name |
|
208 | 208 | end |
|
209 | 209 | end |
|
210 | 210 | flash[:success] = "The following problems are added to the group #{group.name}: " + ok.join(', ') if ok.count > 0 |
|
211 | 211 | flash[:alert] = "The following problems are already in the group #{group.name}: " + failed.join(', ') if failed.count > 0 |
|
212 | 212 | elsif params.has_key? 'add_tags' |
|
213 | 213 | get_problems_from_params.each do |p| |
|
214 | 214 | p.tag_ids += params[:tag_ids] |
|
215 | 215 | end |
|
216 | 216 | end |
|
217 | 217 | |
|
218 | 218 | redirect_to :action => 'manage' |
|
219 | 219 | end |
|
220 | 220 | |
|
221 | 221 | def import |
|
222 | 222 | @allow_test_pair_import = allow_test_pair_import? |
|
223 | 223 | end |
|
224 | 224 | |
|
225 | 225 | def do_import |
|
226 | 226 | old_problem = Problem.find_by_name(params[:name]) |
|
227 | 227 | if !allow_test_pair_import? and params.has_key? :import_to_db |
|
228 | 228 | params.delete :import_to_db |
|
229 | 229 | end |
|
230 | 230 | @problem, import_log = Problem.create_from_import_form_params(params, |
|
231 | 231 | old_problem) |
|
232 | 232 | |
|
233 | 233 | if !@problem.errors.empty? |
|
234 | 234 | render :action => 'import' and return |
|
235 | 235 | end |
|
236 | 236 | |
|
237 | 237 | if old_problem!=nil |
|
238 | 238 | flash[:notice] = "The test data has been replaced for problem #{@problem.name}" |
@@ -1,94 +1,94 | |||
|
1 | 1 | require 'csv' |
|
2 | 2 | |
|
3 | 3 | class ReportController < ApplicationController |
|
4 | 4 | |
|
5 | 5 | before_filter :authenticate |
|
6 | 6 | |
|
7 | 7 | before_filter :admin_authorization, only: [:login_stat,:submission_stat, :stuck, :cheat_report, :cheat_scruntinize, :show_max_score, :current_score] |
|
8 | 8 | |
|
9 | 9 | before_filter(only: [:problem_hof]) { |c| |
|
10 | 10 | return false unless authenticate |
|
11 | 11 | |
|
12 | 12 | admin_authorization unless GraderConfiguration["right.user_view_submission"] |
|
13 | 13 | } |
|
14 | 14 | |
|
15 | 15 | def max_score |
|
16 | 16 | end |
|
17 | 17 | |
|
18 | 18 | def current_score |
|
19 | 19 | @problems = Problem.available_problems |
|
20 | 20 | @users = User.includes(:contests).includes(:contest_stat).where(enabled: true) |
|
21 | 21 | @scorearray = calculate_max_score(@problems, @users,0,0,true) |
|
22 | 22 | |
|
23 | 23 | #rencer accordingly |
|
24 | 24 | if params[:button] == 'download' then |
|
25 | 25 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
26 | 26 | send_data csv, filename: 'max_score.csv' |
|
27 | 27 | else |
|
28 | 28 | #render template: 'user_admin/user_stat' |
|
29 | 29 | render 'current_score' |
|
30 | 30 | end |
|
31 | 31 | end |
|
32 | 32 | |
|
33 | 33 | def show_max_score |
|
34 | 34 | #process parameters |
|
35 | 35 | #problems |
|
36 | 36 | @problems = [] |
|
37 | 37 | if params[:problem_id] |
|
38 | 38 | params[:problem_id].each do |id| |
|
39 | 39 | next unless id.strip != "" |
|
40 | 40 | pid = Problem.find_by_id(id.to_i) |
|
41 | 41 | @problems << pid if pid |
|
42 | 42 | end |
|
43 | 43 | end |
|
44 | 44 | |
|
45 | 45 | #users |
|
46 | - @users = if params[:user] == "all" then | |
|
46 | + @users = if params[:users] == "all" then | |
|
47 | 47 | User.includes(:contests).includes(:contest_stat) |
|
48 | 48 | else |
|
49 | 49 | User.includes(:contests).includes(:contest_stat).where(enabled: true) |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | #set up range from param |
|
53 | 53 | @since_id = params.fetch(:from_id, 0).to_i |
|
54 | 54 | @until_id = params.fetch(:to_id, 0).to_i |
|
55 | 55 | @since_id = nil if @since_id == 0 |
|
56 | 56 | @until_id = nil if @until_id == 0 |
|
57 | 57 | |
|
58 | 58 | #calculate the routine |
|
59 | 59 | @scorearray = calculate_max_score(@problems, @users, @since_id, @until_id) |
|
60 | 60 | |
|
61 | 61 | #rencer accordingly |
|
62 | 62 | if params[:button] == 'download' then |
|
63 | 63 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
64 | 64 | send_data csv, filename: 'max_score.csv' |
|
65 | 65 | else |
|
66 | 66 | #render template: 'user_admin/user_stat' |
|
67 | 67 | render 'max_score' |
|
68 | 68 | end |
|
69 | 69 | |
|
70 | 70 | end |
|
71 | 71 | |
|
72 | 72 | def score |
|
73 | 73 | if params[:commit] == 'download csv' |
|
74 | 74 | @problems = Problem.all |
|
75 | 75 | else |
|
76 | 76 | @problems = Problem.available_problems |
|
77 | 77 | end |
|
78 | 78 | @users = User.includes(:contests, :contest_stat).where(enabled: true) |
|
79 | 79 | @scorearray = Array.new |
|
80 | 80 | @users.each do |u| |
|
81 | 81 | ustat = Array.new |
|
82 | 82 | ustat[0] = u |
|
83 | 83 | @problems.each do |p| |
|
84 | 84 | sub = Submission.find_last_by_user_and_problem(u.id,p.id) |
|
85 | 85 | if (sub!=nil) and (sub.points!=nil) and p and p.full_score |
|
86 | 86 | ustat << [(sub.points.to_f*100/p.full_score).round, (sub.points>=p.full_score)] |
|
87 | 87 | else |
|
88 | 88 | ustat << [0,false] |
|
89 | 89 | end |
|
90 | 90 | end |
|
91 | 91 | @scorearray << ustat |
|
92 | 92 | end |
|
93 | 93 | if params[:commit] == 'download csv' then |
|
94 | 94 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
@@ -1,59 +1,59 | |||
|
1 | 1 | class Submission < ActiveRecord::Base |
|
2 | 2 | |
|
3 | 3 | belongs_to :language |
|
4 | 4 | belongs_to :problem |
|
5 | 5 | belongs_to :user |
|
6 | 6 | |
|
7 | 7 | before_validation :assign_problem |
|
8 | 8 | before_validation :assign_language |
|
9 | 9 | |
|
10 | 10 | validates_presence_of :source |
|
11 | - validates_length_of :source, :maximum => 100_000, :allow_blank => true, :message => 'too long' | |
|
11 | + validates_length_of :source, :maximum => 100_000, :allow_blank => true, :message => 'code too long, the limit is 100,000 bytes' | |
|
12 | 12 | validates_length_of :source, :minimum => 1, :allow_blank => true, :message => 'too short' |
|
13 | 13 | validate :must_have_valid_problem |
|
14 | 14 | validate :must_specify_language |
|
15 | 15 | |
|
16 | 16 | has_one :task |
|
17 | 17 | |
|
18 | 18 | before_save :assign_latest_number_if_new_recond |
|
19 | 19 | |
|
20 | 20 | def self.find_last_by_user_and_problem(user_id, problem_id) |
|
21 | 21 | where("user_id = ? AND problem_id = ?",user_id,problem_id).last |
|
22 | 22 | end |
|
23 | 23 | |
|
24 | 24 | def self.find_all_last_by_problem(problem_id) |
|
25 | 25 | # need to put in SQL command, maybe there's a better way |
|
26 | 26 | Submission.includes(:user).find_by_sql("SELECT * FROM submissions " + |
|
27 | 27 | "WHERE id = " + |
|
28 | 28 | "(SELECT MAX(id) FROM submissions AS subs " + |
|
29 | 29 | "WHERE subs.user_id = submissions.user_id AND " + |
|
30 | 30 | "problem_id = " + problem_id.to_s + " " + |
|
31 | 31 | "GROUP BY user_id) " + |
|
32 | 32 | "ORDER BY user_id") |
|
33 | 33 | end |
|
34 | 34 | |
|
35 | 35 | def self.find_in_range_by_user_and_problem(user_id, problem_id,since_id,until_id) |
|
36 | 36 | records = Submission.where(problem_id: problem_id,user_id: user_id) |
|
37 | 37 | records = records.where('id >= ?',since_id) if since_id and since_id > 0 |
|
38 | 38 | records = records.where('id <= ?',until_id) if until_id and until_id > 0 |
|
39 | 39 | records.all |
|
40 | 40 | end |
|
41 | 41 | |
|
42 | 42 | def self.find_last_for_all_available_problems(user_id) |
|
43 | 43 | submissions = Array.new |
|
44 | 44 | problems = Problem.available_problems |
|
45 | 45 | problems.each do |problem| |
|
46 | 46 | sub = Submission.find_last_by_user_and_problem(user_id, problem.id) |
|
47 | 47 | submissions << sub if sub!=nil |
|
48 | 48 | end |
|
49 | 49 | submissions |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | def self.find_by_user_problem_number(user_id, problem_id, number) |
|
53 | 53 | where("user_id = ? AND problem_id = ? AND number = ?",user_id,problem_id,number).first |
|
54 | 54 | end |
|
55 | 55 | |
|
56 | 56 | def self.find_all_by_user_problem(user_id, problem_id) |
|
57 | 57 | where("user_id = ? AND problem_id = ?",user_id,problem_id) |
|
58 | 58 | end |
|
59 | 59 |
@@ -65,54 +65,55 | |||
|
65 | 65 | - if GraderConfiguration.multicontests? |
|
66 | 66 | %li |
|
67 | 67 | Add selected problems to contest |
|
68 | 68 | = select("contest","id",Contest.all.collect {|c| [c.title, c.id]}) |
|
69 | 69 | = submit_tag 'Add', :name => 'add_to_contest', class: 'btn btn-primary btn-sm' |
|
70 | 70 | %li |
|
71 | 71 | Add selected problems to user group |
|
72 | 72 | = select_tag "group_id", options_from_collection_for_select( Group.all, 'id','name',params[:group_name]), id: 'group_name',class: 'select2' |
|
73 | 73 | = submit_tag 'Add', name: 'add_group', class: 'btn btn-primary' |
|
74 | 74 | %li |
|
75 | 75 | Add the following tags to the selected problems |
|
76 | 76 | = select_tag "tag_ids", options_from_collection_for_select( Tag.all, 'id','name'), id: 'tags_name',class: 'select2', multiple: true, data: {placeholder: 'Select tags by clicking', width: "200px"} |
|
77 | 77 | = submit_tag 'Add', name: 'add_tags', class: 'btn btn-primary' |
|
78 | 78 | |
|
79 | 79 | %table.table.table-hover.datatable |
|
80 | 80 | %thead |
|
81 | 81 | %tr{style: "text-align: left;"} |
|
82 | 82 | %th= check_box_tag 'select_all' |
|
83 | 83 | %th Name |
|
84 | 84 | %th Full name |
|
85 | 85 | %th Tags |
|
86 | 86 | %th Available |
|
87 | 87 | %th Date added |
|
88 | 88 | - if GraderConfiguration.multicontests? |
|
89 | 89 | %th Contests |
|
90 | 90 | |
|
91 | 91 | %tbody |
|
92 | 92 | - num = 0 |
|
93 | 93 | - for problem in @problems |
|
94 | 94 | - num += 1 |
|
95 | 95 | %tr{:id => "row-prob-#{problem.id}", :name=> "prob-#{problem.id}"} |
|
96 | 96 | %td= check_box_tag "prob-#{problem.id}-#{num}" |
|
97 | 97 | %td= problem.name |
|
98 | 98 | %td= problem.full_name |
|
99 | 99 | %td |
|
100 | 100 | - problem.tags.each do |t| |
|
101 | 101 | %span.label.label-default= t.name |
|
102 | 102 | %td= problem.available |
|
103 | 103 | %td= problem.date_added |
|
104 | 104 | - if GraderConfiguration.multicontests? |
|
105 | 105 | %td |
|
106 | 106 | - problem.contests.each do |contest| |
|
107 | 107 | = "(#{contest.name} [#{link_to 'x', :action => 'remove_contest', :id => problem.id, :contest_id => contest.id }])" |
|
108 | 108 | |
|
109 | 109 | :javascript |
|
110 | 110 | $('.input-group.date').datetimepicker({ |
|
111 | 111 | format: 'DD/MMM/YYYY', |
|
112 | 112 | showTodayButton: true, |
|
113 | + locale: 'en', | |
|
113 | 114 | widgetPositioning: {horizontal: 'auto', vertical: 'bottom'}, |
|
114 | 115 | |
|
115 | 116 | }); |
|
116 | 117 | $('.datatable').DataTable({ |
|
117 | 118 | paging: false |
|
118 | 119 | }); |
@@ -1,36 +1,37 | |||
|
1 | 1 | %h1 Editing site |
|
2 | 2 | = error_messages_for :site |
|
3 | 3 | = form_for(@site) do |f| |
|
4 | 4 | .row |
|
5 | 5 | .col-md-4 |
|
6 | 6 | .form-group.field |
|
7 | 7 | = f.label :name, "Name" |
|
8 | 8 | = f.text_field :name, class: 'form-control' |
|
9 | 9 | .form-group.field |
|
10 | 10 | = f.label :password, "Password" |
|
11 | 11 | = f.text_field :password, class: 'form-control' |
|
12 | 12 | .form-group.field |
|
13 | 13 | = f.label :started, "Started" |
|
14 | 14 | = f.check_box :started, class: 'form-control' |
|
15 | 15 | .form-group.field |
|
16 | 16 | = f.label :start_time, "Start time" |
|
17 | 17 | -# = f.datetime_select :start_time, :include_blank => true |
|
18 | 18 | .input-group.date |
|
19 | 19 | = f.text_field :start_time, class:'form-control' , value: (@site.start_time ? @site.start_time.strftime('%d/%b/%Y %H:%M') : '') |
|
20 | 20 | %span.input-group-addon |
|
21 | 21 | %span.glyphicon.glyphicon-calendar |
|
22 | 22 | .actions |
|
23 | 23 | = f.submit "Update", class: 'btn btn-primary' |
|
24 | 24 | .col-md-8 |
|
25 | 25 | |
|
26 | 26 | = link_to 'Show', @site |
|
27 | 27 | | |
|
28 | 28 | = link_to 'Back', sites_path |
|
29 | 29 | |
|
30 | 30 | |
|
31 | 31 | :javascript |
|
32 | 32 | $('.input-group.date').datetimepicker({ |
|
33 | 33 | format: 'DD/MMM/YYYY HH:mm', |
|
34 | + locale: 'en', | |
|
34 | 35 | showTodayButton: true, |
|
35 | 36 | }); |
|
36 | 37 |
@@ -1,62 +1,62 | |||
|
1 | 1 | # encoding: UTF-8 |
|
2 | 2 | # This file is auto-generated from the current state of the database. Instead |
|
3 | 3 | # of editing this file, please use the migrations feature of Active Record to |
|
4 | 4 | # incrementally modify your database, and then regenerate this schema definition. |
|
5 | 5 | # |
|
6 | 6 | # Note that this schema.rb definition is the authoritative source for your |
|
7 | 7 | # database schema. If you need to create the application database on another |
|
8 | 8 | # system, you should be using db:schema:load, not running all the migrations |
|
9 | 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
10 | 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
11 | 11 | # |
|
12 | 12 | # It's strongly recommended that you check this file into your version control system. |
|
13 | 13 | |
|
14 |
- ActiveRecord::Schema.define(version: 201 |
|
|
14 | + ActiveRecord::Schema.define(version: 20180612102327) do | |
|
15 | 15 | |
|
16 | 16 | create_table "announcements", force: :cascade do |t| |
|
17 | 17 | t.string "author", limit: 255 |
|
18 | 18 | t.text "body", limit: 65535 |
|
19 | 19 | t.boolean "published" |
|
20 | 20 | t.datetime "created_at", null: false |
|
21 | 21 | t.datetime "updated_at", null: false |
|
22 | 22 | t.boolean "frontpage", default: false |
|
23 | 23 | t.boolean "contest_only", default: false |
|
24 | 24 | t.string "title", limit: 255 |
|
25 | 25 | t.string "notes", limit: 255 |
|
26 | 26 | end |
|
27 | 27 | |
|
28 | 28 | create_table "contests", force: :cascade do |t| |
|
29 | 29 | t.string "title", limit: 255 |
|
30 | 30 | t.boolean "enabled" |
|
31 | 31 | t.datetime "created_at", null: false |
|
32 | 32 | t.datetime "updated_at", null: false |
|
33 | 33 | t.string "name", limit: 255 |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | 36 | create_table "contests_problems", id: false, force: :cascade do |t| |
|
37 | 37 | t.integer "contest_id", limit: 4 |
|
38 | 38 | t.integer "problem_id", limit: 4 |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | create_table "contests_users", id: false, force: :cascade do |t| |
|
42 | 42 | t.integer "contest_id", limit: 4 |
|
43 | 43 | t.integer "user_id", limit: 4 |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | create_table "countries", force: :cascade do |t| |
|
47 | 47 | t.string "name", limit: 255 |
|
48 | 48 | t.datetime "created_at", null: false |
|
49 | 49 | t.datetime "updated_at", null: false |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | create_table "descriptions", force: :cascade do |t| |
|
53 | 53 | t.text "body", limit: 65535 |
|
54 | 54 | t.boolean "markdowned" |
|
55 | 55 | t.datetime "created_at", null: false |
|
56 | 56 | t.datetime "updated_at", null: false |
|
57 | 57 | end |
|
58 | 58 | |
|
59 | 59 | create_table "grader_configurations", force: :cascade do |t| |
|
60 | 60 | t.string "key", limit: 255 |
|
61 | 61 | t.string "value_type", limit: 255 |
|
62 | 62 | t.string "value", limit: 255 |
@@ -164,97 +164,97 | |||
|
164 | 164 | create_table "rights_roles", id: false, force: :cascade do |t| |
|
165 | 165 | t.integer "right_id", limit: 4 |
|
166 | 166 | t.integer "role_id", limit: 4 |
|
167 | 167 | end |
|
168 | 168 | |
|
169 | 169 | add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree |
|
170 | 170 | |
|
171 | 171 | create_table "roles", force: :cascade do |t| |
|
172 | 172 | t.string "name", limit: 255 |
|
173 | 173 | end |
|
174 | 174 | |
|
175 | 175 | create_table "roles_users", id: false, force: :cascade do |t| |
|
176 | 176 | t.integer "role_id", limit: 4 |
|
177 | 177 | t.integer "user_id", limit: 4 |
|
178 | 178 | end |
|
179 | 179 | |
|
180 | 180 | add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree |
|
181 | 181 | |
|
182 | 182 | create_table "sessions", force: :cascade do |t| |
|
183 | 183 | t.string "session_id", limit: 255 |
|
184 | 184 | t.text "data", limit: 65535 |
|
185 | 185 | t.datetime "updated_at" |
|
186 | 186 | end |
|
187 | 187 | |
|
188 | 188 | add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree |
|
189 | 189 | add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree |
|
190 | 190 | |
|
191 | 191 | create_table "sites", force: :cascade do |t| |
|
192 | 192 | t.string "name", limit: 255 |
|
193 | 193 | t.boolean "started" |
|
194 | 194 | t.datetime "start_time" |
|
195 | 195 | t.datetime "created_at", null: false |
|
196 | 196 | t.datetime "updated_at", null: false |
|
197 | 197 | t.integer "country_id", limit: 4 |
|
198 | 198 | t.string "password", limit: 255 |
|
199 | 199 | end |
|
200 | 200 | |
|
201 | 201 | create_table "submission_view_logs", force: :cascade do |t| |
|
202 | 202 | t.integer "user_id", limit: 4 |
|
203 | 203 | t.integer "submission_id", limit: 4 |
|
204 | 204 | t.datetime "created_at", null: false |
|
205 | 205 | t.datetime "updated_at", null: false |
|
206 | 206 | end |
|
207 | 207 | |
|
208 | 208 | create_table "submissions", force: :cascade do |t| |
|
209 | 209 | t.integer "user_id", limit: 4 |
|
210 | 210 | t.integer "problem_id", limit: 4 |
|
211 | 211 | t.integer "language_id", limit: 4 |
|
212 |
- t.text "source", limit: |
|
|
212 | + t.text "source", limit: 16777215 | |
|
213 | 213 | t.binary "binary", limit: 65535 |
|
214 | 214 | t.datetime "submitted_at" |
|
215 | 215 | t.datetime "compiled_at" |
|
216 | 216 | t.text "compiler_message", limit: 65535 |
|
217 | 217 | t.datetime "graded_at" |
|
218 | 218 | t.integer "points", limit: 4 |
|
219 | 219 | t.text "grader_comment", limit: 65535 |
|
220 | 220 | t.integer "number", limit: 4 |
|
221 | 221 | t.string "source_filename", limit: 255 |
|
222 | 222 | t.float "max_runtime", limit: 24 |
|
223 | 223 | t.integer "peak_memory", limit: 4 |
|
224 | 224 | t.integer "effective_code_length", limit: 4 |
|
225 | 225 | t.string "ip_address", limit: 255 |
|
226 | 226 | end |
|
227 | 227 | |
|
228 | 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 | 229 | add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree |
|
230 | 230 | |
|
231 | 231 | create_table "tags", force: :cascade do |t| |
|
232 | 232 | t.string "name", limit: 255, null: false |
|
233 | 233 | t.text "description", limit: 65535 |
|
234 | 234 | t.boolean "public" |
|
235 | 235 | t.datetime "created_at", null: false |
|
236 | 236 | t.datetime "updated_at", null: false |
|
237 | 237 | end |
|
238 | 238 | |
|
239 | 239 | create_table "tasks", force: :cascade do |t| |
|
240 | 240 | t.integer "submission_id", limit: 4 |
|
241 | 241 | t.datetime "created_at" |
|
242 | 242 | t.integer "status", limit: 4 |
|
243 | 243 | t.datetime "updated_at" |
|
244 | 244 | end |
|
245 | 245 | |
|
246 | 246 | add_index "tasks", ["submission_id"], name: "index_tasks_on_submission_id", using: :btree |
|
247 | 247 | |
|
248 | 248 | create_table "test_pairs", force: :cascade do |t| |
|
249 | 249 | t.integer "problem_id", limit: 4 |
|
250 | 250 | t.text "input", limit: 16777215 |
|
251 | 251 | t.text "solution", limit: 16777215 |
|
252 | 252 | t.datetime "created_at", null: false |
|
253 | 253 | t.datetime "updated_at", null: false |
|
254 | 254 | end |
|
255 | 255 | |
|
256 | 256 | create_table "test_requests", force: :cascade do |t| |
|
257 | 257 | t.integer "user_id", limit: 4 |
|
258 | 258 | t.integer "problem_id", limit: 4 |
|
259 | 259 | t.integer "submission_id", limit: 4 |
|
260 | 260 | t.string "input_file_name", limit: 255 |
You need to be logged in to leave comments.
Login now