Description:
merge algo feature
Commit status:
[Not Reviewed]
References:
merge java
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r509:bb124a034509 - - 8 files changed: 112 inserted, 53 deleted

@@ -0,0 +1,5
1 + class AddIpToSubmissions < ActiveRecord::Migration
2 + def change
3 + add_column :submissions, :ip_address, :string
4 + end
5 + end
@@ -22,96 +22,97
22 22 # COMMENT OUT: only need when having high load
23 23 # caches_action :index, :login
24 24
25 25 # NOTE: This method is not actually needed, 'config/routes.rb' has
26 26 # assigned action login as a default action.
27 27 def index
28 28 redirect_to :action => 'login'
29 29 end
30 30
31 31 def login
32 32 saved_notice = flash[:notice]
33 33 reset_session
34 34 flash.now[:notice] = saved_notice
35 35
36 36 # EXPERIMENT:
37 37 # Hide login if in single user mode and the url does not
38 38 # explicitly specify /login
39 39 #
40 40 # logger.info "PATH: #{request.path}"
41 41 # if GraderConfiguration['system.single_user_mode'] and
42 42 # request.path!='/main/login'
43 43 # @hidelogin = true
44 44 # end
45 45
46 46 @announcements = Announcement.find_for_frontpage
47 47 render :action => 'login', :layout => 'empty'
48 48 end
49 49
50 50 def list
51 51 prepare_list_information
52 52 end
53 53
54 54 def help
55 55 @user = User.find(session[:user_id])
56 56 end
57 57
58 58 def submit
59 59 user = User.find(session[:user_id])
60 60
61 61 @submission = Submission.new
62 62 @submission.problem_id = params[:submission][:problem_id]
63 63 @submission.user = user
64 64 @submission.language_id = 0
65 65 if (params['file']) and (params['file']!='')
66 66 @submission.source = params['file'].read
67 67 @submission.source_filename = params['file'].original_filename
68 68 end
69 69 @submission.submitted_at = Time.new.gmtime
70 + @submission.ip_address = request.remote_ip
70 71
71 72 if GraderConfiguration.time_limit_mode? and user.contest_finished?
72 73 @submission.errors.add_to_base "The contest is over."
73 74 prepare_list_information
74 75 render :action => 'list' and return
75 76 end
76 77
77 78 if @submission.valid?
78 79 if @submission.save == false
79 80 flash[:notice] = 'Error saving your submission'
80 81 elsif Task.create(:submission_id => @submission.id,
81 82 :status => Task::STATUS_INQUEUE) == false
82 83 flash[:notice] = 'Error adding your submission to task queue'
83 84 end
84 85 else
85 86 prepare_list_information
86 87 render :action => 'list' and return
87 88 end
88 89 redirect_to :action => 'list'
89 90 end
90 91
91 92 def source
92 93 submission = Submission.find(params[:id])
93 94 if ((submission.user_id == session[:user_id]) and
94 95 (submission.problem != nil) and
95 96 (submission.problem.available))
96 97 send_data(submission.source,
97 98 {:filename => submission.download_filename,
98 99 :type => 'text/plain'})
99 100 else
100 101 flash[:notice] = 'Error viewing source'
101 102 redirect_to :action => 'list'
102 103 end
103 104 end
104 105
105 106 def compiler_msg
106 107 @submission = Submission.find(params[:id])
107 108 if @submission.user_id == session[:user_id]
108 109 render :action => 'compiler_msg', :layout => 'empty'
109 110 else
110 111 flash[:notice] = 'Error viewing source'
111 112 redirect_to :action => 'list'
112 113 end
113 114 end
114 115
115 116 def submission
116 117 @user = User.find(session[:user_id])
117 118 @problems = @user.available_problems
@@ -1,89 +1,95
1 1 class ReportController < ApplicationController
2 2
3 3 before_filter :admin_authorization, only: [:login_stat,:submission_stat]
4 4 before_filter(only: [:problem_hof]) { |c|
5 5 return false unless authenticate
6 6
7 7 if GraderConfiguration["right.user_view_submission"]
8 8 return true;
9 9 end
10 10
11 11 admin_authorization
12 12 }
13 13
14 14 def login_stat
15 15 @logins = Array.new
16 16
17 17 date_and_time = '%Y-%m-%d %H:%M'
18 18 begin
19 - @since_time = DateTime.strptime(params[:since_datetime],date_and_time)
19 + md = params[:since_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/)
20 + @since_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i)
20 21 rescue
21 22 @since_time = DateTime.new(1000,1,1)
22 23 end
23 24 begin
24 - @until_time = DateTime.strptime(params[:until_datetime],date_and_time)
25 + md = params[:until_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/)
26 + @until_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i)
25 27 rescue
26 28 @until_time = DateTime.new(3000,1,1)
27 29 end
28 30
29 31 User.all.each do |user|
30 32 @logins << { id: user.id,
31 33 login: user.login,
32 34 full_name: user.full_name,
33 35 count: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
34 36 user.id,@since_time,@until_time)
35 37 .count(:id),
36 38 min: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
37 39 user.id,@since_time,@until_time)
38 40 .minimum(:created_at),
39 41 max: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
40 42 user.id,@since_time,@until_time)
41 - .maximum(:created_at)
43 + .maximum(:created_at),
44 + ip: Login.where("user_id = ? AND created_at >= ? AND created_at <= ?",
45 + user.id,@since_time,@until_time)
46 + .select(:ip_address).uniq
47 +
42 48 }
43 49 end
44 50 end
45 51
46 52 def submission_stat
47 53
48 54 date_and_time = '%Y-%m-%d %H:%M'
49 55 begin
50 56 @since_time = DateTime.strptime(params[:since_datetime],date_and_time)
51 57 rescue
52 58 @since_time = DateTime.new(1000,1,1)
53 59 end
54 60 begin
55 61 @until_time = DateTime.strptime(params[:until_datetime],date_and_time)
56 62 rescue
57 63 @until_time = DateTime.new(3000,1,1)
58 64 end
59 65
60 66 @submissions = {}
61 67
62 68 User.find_each do |user|
63 69 @submissions[user.id] = { login: user.login, full_name: user.full_name, count: 0, sub: { } }
64 70 end
65 71
66 72 Submission.where("submitted_at >= ? AND submitted_at <= ?",@since_time,@until_time).find_each do |s|
67 73 if @submissions[s.user_id]
68 74 if not @submissions[s.user_id][:sub].has_key?(s.problem_id)
69 75 a = nil
70 76 begin
71 77 a = Problem.find(s.problem_id)
72 78 rescue
73 79 a = nil
74 80 end
75 81 @submissions[s.user_id][:sub][s.problem_id] =
76 82 { prob_name: (a ? a.full_name : '(NULL)'),
77 83 sub_ids: [s.id] }
78 84 else
79 85 @submissions[s.user_id][:sub][s.problem_id][:sub_ids] << s.id
80 86 end
81 87 @submissions[s.user_id][:count] += 1
82 88 end
83 89 end
84 90 end
85 91
86 92 def problem_hof
87 93 # gen problem list
88 94 @user = User.find(session[:user_id])
89 95 @problems = @user.available_problems
@@ -119,71 +125,71
119 125
120 126 if sub.max_runtime and sub.max_runtime < @by_lang[lang.pretty_name][:runtime][:value]
121 127 @by_lang[lang.pretty_name][:runtime] = {
122 128 avail: true,
123 129 user_id: sub.user_id,
124 130 value: sub.max_runtime,
125 131 sub_id: sub.id
126 132 }
127 133 end
128 134
129 135 if sub.peak_memory and sub.peak_memory < @by_lang[lang.pretty_name][:memory][:value]
130 136 @by_lang[lang.pretty_name][:memory] = {
131 137 avail: true,
132 138 user_id: sub.user_id,
133 139 value: sub.peak_memory,
134 140 sub_id: sub.id
135 141 }
136 142 end
137 143
138 144 if sub.submitted_at and sub.submitted_at < @by_lang[lang.pretty_name][:first][:value] and
139 145 !sub.user.admin?
140 146 @by_lang[lang.pretty_name][:first] = {
141 147 avail: true,
142 148 user_id: sub.user_id,
143 149 value: sub.submitted_at,
144 150 sub_id: sub.id
145 151 }
146 152 end
147 153
148 154 if @by_lang[lang.pretty_name][:length][:value] > sub.effective_code_length
149 155 @by_lang[lang.pretty_name][:length] = {
150 156 avail: true,
151 157 user_id: sub.user_id,
152 158 value: sub.effective_code_length,
153 159 sub_id: sub.id
154 160 }
155 161 end
156 162 end
157 163
158 164 #process user_id
159 165 @by_lang.each do |lang,prop|
160 166 prop.each do |k,v|
161 167 v[:user] = User.exists?(v[:user_id]) ? User.find(v[:user_id]).full_name : "(NULL)"
162 168 end
163 169 end
164 170
165 171 #sum into best
166 172 if @by_lang and @by_lang.first
167 - @best = @by_lang.first[1]
173 + @best = @by_lang.first[1].clone
168 174 @by_lang.each do |lang,prop|
169 175 if @best[:runtime][:value] >= prop[:runtime][:value]
170 176 @best[:runtime] = prop[:runtime]
171 177 @best[:runtime][:lang] = lang
172 178 end
173 179 if @best[:memory][:value] >= prop[:memory][:value]
174 180 @best[:memory] = prop[:memory]
175 181 @best[:memory][:lang] = lang
176 182 end
177 183 if @best[:length][:value] >= prop[:length][:value]
178 184 @best[:length] = prop[:length]
179 185 @best[:length][:lang] = lang
180 186 end
181 187 if @best[:first][:value] >= prop[:first][:value]
182 188 @best[:first] = prop[:first]
183 189 @best[:first][:lang] = lang
184 190 end
185 191 end
186 192 end
187 193 end
188 194 end
189 195 end
@@ -1,27 +1,61
1 1 %style{type: "text/css"}
2 2 = @css_style
3 + :css
4 + .field {
5 + font-weight: bold;
6 + text-align: right;
7 + padding: 3px;
8 + }
9 +
3 10
4 11 %h1= "Submission: #{@submission.id}"
5 12
6 - %p
7 - User:
8 - = "(#{@submission.user.login}) #{@submission.user.full_name}"
9 - %br/
10 - Problem:
11 - - if @submission.problem!=nil
12 - = "#{@submission.problem.full_name}"
13 - - else
14 - = "(n/a)"
15 - %br/
16 - = "Number: #{@submission.number}"
17 - %br/
18 - = "Submitted at: #{format_short_time(@submission.submitted_at)}"
19 - %br/
20 - = "Points : #{@submission.points}/#{@submission.problem.full_score}"
21 - %br/
22 - = "Comment : #{@submission.grader_comment}"
13 +
14 + %h2 Stat
23 15
24 - %b Source code (first 10kb)
16 + %table.info
17 + %thead
18 + %tr.info-head
19 + %th Field
20 + %th Value
21 + %tbody
22 + %tr{class: cycle('info-even','info-odd')}
23 + %td.field User:
24 + %td.value= "(#{@submission.user.login}) #{@submission.user.full_name}"
25 + %tr{class: cycle('info-even','info-odd')}
26 + %td.field Problem:
27 + %td.value
28 + - if @submission.problem!=nil
29 + = "(#{@submission.problem.name}) #{@submission.problem.full_name}"
30 + - else
31 + = "(n/a)"
32 + %tr{class: cycle('info-even','info-odd')}
33 + %td.field Tries:
34 + %td.value= @submission.number
35 + %tr{class: cycle('info-even','info-odd')}
36 + %td.field Submitted:
37 + %td.value #{time_ago_in_words(@submission.submitted_at)} ago (at #{@submission.submitted_at.to_formatted_s(:long)})
38 + %tr{class: cycle('info-even','info-odd')}
39 + %td.field Graded:
40 + %td.value #{time_ago_in_words(@submission.graded_at)} ago (at #{@submission.graded_at.to_formatted_s(:long)})
41 + %tr{class: cycle('info-even','info-odd')}
42 + %td.field Points:
43 + %td.value #{@submission.points}/#{@submission.problem.full_score}
44 + %tr{class: cycle('info-even','info-odd')}
45 + %td.field Comment:
46 + %td.value #{@submission.grader_comment}
47 + %tr{class: cycle('info-even','info-odd')}
48 + %td.field Runtime (s):
49 + %td.value #{@submission.max_runtime}
50 + %tr{class: cycle('info-even','info-odd')}
51 + %td.field Memory (kb):
52 + %td.value #{@submission.peak_memory}
53 + - if session[:admin]
54 + %tr{class: cycle('info-even','info-odd')}
55 + %td.field IP:
56 + %td.value #{@submission.ip_address}
57 +
58 + %h2 Source code
25 59 //%div.highlight{:style => "border: 1px solid black;"}
26 60 =@formatted_code.html_safe
27 61
@@ -1,79 +1,79
1 1 :css
2 2 .hof_user { color: orangered; font-style: italic; }
3 3 .hof_language { color: green; font-style: italic; }
4 4 .hof_value { color: deeppink;font-style: italic; }
5 5
6 - %h2 Overall
6 + %h2 Overall of #{Problem.find(params[:id]).full_name}
7 7
8 8 - if @best
9 9 %b Best Runtime:
10 10 by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
11 11 using <span class="hof_language">#{@best[:runtime][:lang]}</span>
12 12 with <span class="hof_value">#{@best[:runtime][:value] * 1000} milliseconds</span>
13 13 at submission
14 14 = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id])
15 15 %br/
16 16
17 17 %b Best Memory Usage:
18 18 by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
19 19 using <span class="hof_language">#{@best[:memory][:lang]}</span>
20 - with <span class="hof_value">#{@best[:memory][:value]} kbytes </span>
20 + with <span class="hof_value">#{number_with_delimiter(@best[:memory][:value])} kbytes </span>
21 21 at submission
22 22 = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id])
23 23 %br/
24 24
25 25 %b Shortest Code:
26 26 by #{link_to @best[:length][:user], controller:'users', action:'profile', id:@best[:length][:user_id]}
27 27 using <span class="hof_language">#{@best[:length][:lang]}</span>
28 28 with <span class="hof_value">#{@best[:length][:value]} bytes</span>
29 29 at submission
30 30 = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id])
31 31 %br/
32 32
33 33 %b First solver:
34 34 #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver
35 35 using <span class="hof_language">#{@best[:first][:lang]}</span>
36 36 on <span class="hof_value">#{@best[:first][:value]}</span>
37 37 at submission
38 38 = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id])
39 39 %br/
40 40
41 41
42 42 %p
43 43 This counts only for submission with 100% score <br/>
44 44 Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...)
45 45
46 46 %h2 By language
47 47
48 48 %table.info
49 49 %thead
50 50 %tr.info-head
51 51 %th Language
52 52 %th Best runtime (ms)
53 53 %th Best memory (kbytes)
54 54 %th Shortest Code (bytes)
55 55 %th First solver
56 56 %tbody
57 57 - @by_lang.each do |lang,value|
58 58 %tr{class: cycle('info-even','info-odd')}
59 59 %td= lang
60 60 %td
61 61 = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id]
62 62 = "(#{(value[:runtime][:value] * 1000).to_i} @"
63 63 = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe
64 64 %td
65 65 = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id]
66 - = "(#{value[:memory][:value]} @"
66 + = "(#{number_with_delimiter(value[:memory][:value])} @"
67 67 = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe
68 68 %td
69 69 = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id]
70 70 = "(#{value[:length][:value]} @"
71 71 = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe
72 72 %td
73 73 - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong...
74 74 = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id]
75 75 = "(#{value[:first][:value]} @"
76 76 = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe
77 77
78 78 - else
79 79 %h3 No submissions
@@ -1,32 +1,36
1 1 - content_for :header do
2 2 = stylesheet_link_tag 'tablesorter-theme.cafe'
3 3 = javascript_include_tag 'new'
4 4
5 5 %script{:type=>"text/javascript"}
6 6 $(function () {
7 7 $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} );
8 8 $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} );
9 9 $('#my_table').tablesorter({widthFixed: true, widgets: ['zebra']});
10 10 });
11 11
12 12 %h1 Login status
13 13
14 14 =render partial: 'report_menu'
15 15 =render partial: 'date_range', locals: {param_text: 'Login date range:', title: 'Query login stat in the range' }
16 16
17 17 %table.tablesorter-cafe#my_table
18 18 %thead
19 19 %tr
20 20 %th login
21 21 %th full name
22 22 %th login count
23 23 %th earliest
24 24 %th latest
25 + %th IP
25 26 %tbody
26 27 - @logins.each do |l|
27 28 %tr{class: cycle('info-even','info-odd')}
28 29 %td= link_to l[:login], controller: 'users', action: 'profile', id: l[:id]
29 30 %td= l[:full_name]
30 31 %td= l[:count]
31 32 %td= l[:min] ? l[:min].in_time_zone.strftime('%Y-%m-%d %H:%M') : ''
32 - %td= l[:max] ? time_ago_in_words(l[:max].in_time_zone) + ' ago' : ''
33 + %td= l[:max] ? "#{l[:max].in_time_zone.strftime('%Y-%m-%d %H:%M.%S')} (#{time_ago_in_words(l[:max].in_time_zone)} ago)" : ''
34 + %td
35 + - l[:ip].each do |ip|
36 + #{ip.ip_address} <br/>
@@ -1,46 +1,50
1 1 - content_for :header do
2 2 = javascript_include_tag 'new'
3 3
4 4 %script{:type=>"text/javascript"}
5 5 $(function () {
6 6 $('#submission_table').tablesorter({widgets: ['zebra','filter']});
7 7 });
8 8
9 9 :css
10 10 .fix-width {
11 11 font-family: Droid Sans Mono,Consolas, monospace, mono, Courier New, Courier;
12 12 }
13 13
14 14 %h1= @user.full_name + ' Profile'
15 15
16 16 %h2 Basic info
17 17 <b>Login:</b> #{@user.login} <br/>
18 18 <b>Full name:</b> #{@user.full_name} <br />
19 19
20 20
21 21 %h2 Problem Stat
22 22
23 23 %h2 Submissions
24 24
25 25 %table.tablesorter-cafe#submission_table
26 26 %thead
27 27 %tr
28 28 %th ID
29 29 %th Problem code
30 30 %th Problem name
31 31 %th Language
32 32 %th Result
33 33 %th Score
34 + - if session[:admin]
35 + %th IP
34 36 %tbody
35 37 - @submission.each do |s|
36 38 - next unless s.problem
37 39 %tr
38 40 %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id
39 41 %td= s.problem.name
40 42 %td= s.problem.full_name
41 43 %td= s.language.pretty_name
42 44 %td.fix-width= s.grader_comment
43 - %td= s.points/s.problem.full_score * 100
45 + %td= (s.points*100)/s.problem.full_score
46 + - if session[:admin]
47 + %td= s.ip_address
44 48
45 49
46 50
@@ -1,242 +1,247
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 to check this file into your version control system.
13 13
14 - ActiveRecord::Schema.define(:version => 20140826095949) do
14 + ActiveRecord::Schema.define(:version => 20140917150629) do
15 15
16 16 create_table "announcements", :force => true do |t|
17 17 t.string "author"
18 - t.text "body", :limit => 16777215
18 + t.text "body"
19 19 t.boolean "published"
20 - t.datetime "created_at", :null => false
21 - t.datetime "updated_at", :null => false
22 - t.boolean "frontpage", :default => false
23 - t.boolean "contest_only", :default => false
20 + t.datetime "created_at", :null => false
21 + t.datetime "updated_at", :null => false
22 + t.boolean "frontpage", :default => false
23 + t.boolean "contest_only", :default => false
24 24 t.string "title"
25 25 t.string "notes"
26 26 end
27 27
28 28 create_table "contests", :force => true do |t|
29 29 t.string "title"
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"
34 34 end
35 35
36 36 create_table "contests_problems", :id => false, :force => true do |t|
37 37 t.integer "contest_id"
38 38 t.integer "problem_id"
39 39 end
40 40
41 41 create_table "contests_users", :id => false, :force => true do |t|
42 42 t.integer "contest_id"
43 43 t.integer "user_id"
44 44 end
45 45
46 46 create_table "countries", :force => true do |t|
47 47 t.string "name"
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 => true do |t|
53 - t.text "body", :limit => 16777215
53 + t.text "body"
54 54 t.boolean "markdowned"
55 - t.datetime "created_at", :null => false
56 - t.datetime "updated_at", :null => false
55 + t.datetime "created_at", :null => false
56 + t.datetime "updated_at", :null => false
57 57 end
58 58
59 59 create_table "grader_configurations", :force => true do |t|
60 60 t.string "key"
61 61 t.string "value_type"
62 62 t.string "value"
63 - t.datetime "created_at", :null => false
64 - t.datetime "updated_at", :null => false
65 - t.text "description", :limit => 16777215
63 + t.datetime "created_at", :null => false
64 + t.datetime "updated_at", :null => false
65 + t.text "description"
66 66 end
67 67
68 68 create_table "grader_processes", :force => true do |t|
69 69 t.string "host", :limit => 20
70 70 t.integer "pid"
71 71 t.string "mode"
72 72 t.boolean "active"
73 73 t.datetime "created_at", :null => false
74 74 t.datetime "updated_at", :null => false
75 75 t.integer "task_id"
76 76 t.string "task_type"
77 77 t.boolean "terminated"
78 78 end
79 79
80 80 add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid"
81 81
82 82 create_table "languages", :force => true do |t|
83 83 t.string "name", :limit => 10
84 84 t.string "pretty_name"
85 85 t.string "ext", :limit => 10
86 86 t.string "common_ext"
87 87 end
88 88
89 89 create_table "logins", :force => true do |t|
90 90 t.string "user_id"
91 91 t.string "ip_address"
92 92 t.datetime "created_at", :null => false
93 93 t.datetime "updated_at", :null => false
94 94 end
95 95
96 96 create_table "messages", :force => true do |t|
97 97 t.integer "sender_id"
98 98 t.integer "receiver_id"
99 99 t.integer "replying_message_id"
100 - t.text "body", :limit => 16777215
100 + t.text "body"
101 101 t.boolean "replied"
102 - t.datetime "created_at", :null => false
103 - t.datetime "updated_at", :null => false
102 + t.datetime "created_at", :null => false
103 + t.datetime "updated_at", :null => false
104 104 end
105 105
106 106 create_table "problems", :force => true do |t|
107 107 t.string "name", :limit => 30
108 108 t.string "full_name"
109 109 t.integer "full_score"
110 110 t.date "date_added"
111 111 t.boolean "available"
112 112 t.string "url"
113 113 t.integer "description_id"
114 114 t.boolean "test_allowed"
115 115 t.boolean "output_only"
116 116 t.string "description_filename"
117 117 end
118 118
119 119 create_table "rights", :force => true do |t|
120 120 t.string "name"
121 121 t.string "controller"
122 122 t.string "action"
123 123 end
124 124
125 125 create_table "rights_roles", :id => false, :force => true do |t|
126 126 t.integer "right_id"
127 127 t.integer "role_id"
128 128 end
129 129
130 130 add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id"
131 131
132 132 create_table "roles", :force => true do |t|
133 133 t.string "name"
134 134 end
135 135
136 136 create_table "roles_users", :id => false, :force => true do |t|
137 137 t.integer "role_id"
138 138 t.integer "user_id"
139 139 end
140 140
141 141 add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id"
142 142
143 143 create_table "sessions", :force => true do |t|
144 144 t.string "session_id"
145 - t.text "data", :limit => 16777215
145 + t.text "data"
146 146 t.datetime "updated_at"
147 147 end
148 148
149 149 add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
150 150 add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
151 151
152 152 create_table "sites", :force => true do |t|
153 153 t.string "name"
154 154 t.boolean "started"
155 155 t.datetime "start_time"
156 156 t.datetime "created_at", :null => false
157 157 t.datetime "updated_at", :null => false
158 158 t.integer "country_id"
159 159 t.string "password"
160 160 end
161 161
162 162 create_table "submissions", :force => true do |t|
163 163 t.integer "user_id"
164 164 t.integer "problem_id"
165 165 t.integer "language_id"
166 - t.text "source", :limit => 16777215
166 + t.text "source"
167 167 t.binary "binary"
168 168 t.datetime "submitted_at"
169 169 t.datetime "compiled_at"
170 - t.text "compiler_message", :limit => 16777215
170 + t.text "compiler_message"
171 171 t.datetime "graded_at"
172 172 t.integer "points"
173 - t.text "grader_comment", :limit => 16777215
173 + t.text "grader_comment"
174 174 t.integer "number"
175 175 t.string "source_filename"
176 + t.float "max_runtime"
177 + t.integer "peak_memory"
178 + t.integer "effective_code_length"
179 + t.string "ip_address"
176 180 end
177 181
178 182 add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true
179 183 add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id"
180 184
181 185 create_table "tasks", :force => true do |t|
182 186 t.integer "submission_id"
183 187 t.datetime "created_at"
184 188 t.integer "status"
185 189 t.datetime "updated_at"
186 190 end
187 191
188 192 create_table "test_pairs", :force => true do |t|
189 193 t.integer "problem_id"
190 - t.text "input", :limit => 2147483647
191 - t.text "solution", :limit => 2147483647
192 - t.datetime "created_at", :null => false
193 - t.datetime "updated_at", :null => false
194 + t.text "input", :limit => 16777215
195 + t.text "solution", :limit => 16777215
196 + t.datetime "created_at", :null => false
197 + t.datetime "updated_at", :null => false
194 198 end
195 199
196 200 create_table "test_requests", :force => true do |t|
197 201 t.integer "user_id"
198 202 t.integer "problem_id"
199 203 t.integer "submission_id"
200 204 t.string "input_file_name"
201 205 t.string "output_file_name"
202 206 t.string "running_stat"
203 207 t.integer "status"
204 - t.datetime "updated_at", :null => false
208 + t.datetime "updated_at", :null => false
205 209 t.datetime "submitted_at"
206 210 t.datetime "compiled_at"
207 - t.text "compiler_message", :limit => 16777215
211 + t.text "compiler_message"
208 212 t.datetime "graded_at"
209 213 t.string "grader_comment"
210 - t.datetime "created_at", :null => false
214 + t.datetime "created_at", :null => false
211 215 t.float "running_time"
212 216 t.string "exit_status"
213 217 t.integer "memory_usage"
214 218 end
215 219
216 220 add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id"
217 221
218 222 create_table "user_contest_stats", :force => true do |t|
219 223 t.integer "user_id"
220 224 t.datetime "started_at"
221 225 t.datetime "created_at", :null => false
222 226 t.datetime "updated_at", :null => false
223 227 t.boolean "forced_logout"
224 228 end
225 229
226 230 create_table "users", :force => true do |t|
227 231 t.string "login", :limit => 50
228 232 t.string "full_name"
229 233 t.string "hashed_password"
230 234 t.string "salt", :limit => 5
231 235 t.string "alias"
232 236 t.string "email"
233 237 t.integer "site_id"
234 238 t.integer "country_id"
235 239 t.boolean "activated", :default => false
236 240 t.datetime "created_at"
237 241 t.datetime "updated_at"
242 + t.string "section"
238 243 end
239 244
240 245 add_index "users", ["login"], :name => "index_users_on_login", :unique => true
241 246
242 247 end
You need to be logged in to leave comments. Login now