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 |
@@ -178,25 +178,25 | |||
|
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| |
@@ -34,25 +34,25 | |||
|
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 |
@@ -1,23 +1,23 | |||
|
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 |
@@ -101,18 +101,19 | |||
|
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 | }); |
@@ -22,15 +22,16 | |||
|
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 |
@@ -2,25 +2,25 | |||
|
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 |
@@ -200,25 +200,25 | |||
|
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 |
You need to be logged in to leave comments.
Login now