Description:
[web] added support for output only problems git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@188 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r99:ab383e0b489e - - 5 files changed: 65 inserted, 22 deleted

@@ -0,0 +1,11
1 + class AddSupportsForOutputOnlyProblems < ActiveRecord::Migration
2 + def self.up
3 + add_column :submissions, :source_filename, :string
4 + add_column :problems, :output_only, :boolean
5 + end
6 +
7 + def self.down
8 + remove_column :submissions, :source_filename
9 + add_column :problems, :output_only, :boolean
10 + end
11 + end
@@ -1,84 +1,87
1 class MainController < ApplicationController
1 class MainController < ApplicationController
2
2
3 before_filter :authenticate, :except => [:index, :login]
3 before_filter :authenticate, :except => [:index, :login]
4
4
5 #
5 #
6 # COMMENT OUT: filter in each action instead
6 # COMMENT OUT: filter in each action instead
7 #
7 #
8 # before_filter :verify_time_limit, :only => [:submit]
8 # before_filter :verify_time_limit, :only => [:submit]
9
9
10 verify :method => :post, :only => [:submit],
10 verify :method => :post, :only => [:submit],
11 :redirect_to => { :action => :index }
11 :redirect_to => { :action => :index }
12
12
13
13
14 def index
14 def index
15 redirect_to :action => 'login'
15 redirect_to :action => 'login'
16 end
16 end
17
17
18 def login
18 def login
19 saved_notice = flash[:notice]
19 saved_notice = flash[:notice]
20 reset_session
20 reset_session
21 flash[:notice] = saved_notice
21 flash[:notice] = saved_notice
22
22
23 render :action => 'login', :layout => 'empty'
23 render :action => 'login', :layout => 'empty'
24 end
24 end
25
25
26 def list
26 def list
27 prepare_list_information
27 prepare_list_information
28 end
28 end
29
29
30 def submit
30 def submit
31 user = User.find(session[:user_id])
31 user = User.find(session[:user_id])
32
32
33 @submission = Submission.new(params[:submission])
33 @submission = Submission.new(params[:submission])
34 @submission.user = user
34 @submission.user = user
35 @submission.language_id = 0
35 @submission.language_id = 0
36 - @submission.source = params['file'].read if params['file']!=''
36 + if params['file']!=''
37 + @submission.source = params['file'].read
38 + @submission.source_filename = params['file'].original_filename
39 + end
37 @submission.submitted_at = Time.new
40 @submission.submitted_at = Time.new
38
41
39 if user.site!=nil and user.site.finished?
42 if user.site!=nil and user.site.finished?
40 @submission.errors.add_to_base "The contest is over."
43 @submission.errors.add_to_base "The contest is over."
41 prepare_list_information
44 prepare_list_information
42 render :action => 'list' and return
45 render :action => 'list' and return
43 end
46 end
44
47
45 if @submission.valid?
48 if @submission.valid?
46 if @submission.save == false
49 if @submission.save == false
47 flash[:notice] = 'Error saving your submission'
50 flash[:notice] = 'Error saving your submission'
48 elsif Task.create(:submission_id => @submission.id,
51 elsif Task.create(:submission_id => @submission.id,
49 :status => Task::STATUS_INQUEUE) == false
52 :status => Task::STATUS_INQUEUE) == false
50 flash[:notice] = 'Error adding your submission to task queue'
53 flash[:notice] = 'Error adding your submission to task queue'
51 end
54 end
52 else
55 else
53 prepare_list_information
56 prepare_list_information
54 render :action => 'list' and return
57 render :action => 'list' and return
55 end
58 end
56 redirect_to :action => 'list'
59 redirect_to :action => 'list'
57 end
60 end
58
61
59 def source
62 def source
60 submission = Submission.find(params[:id])
63 submission = Submission.find(params[:id])
61 if submission.user_id == session[:user_id]
64 if submission.user_id == session[:user_id]
62 fname = submission.problem.name + '.' + submission.language.ext
65 fname = submission.problem.name + '.' + submission.language.ext
63 send_data(submission.source,
66 send_data(submission.source,
64 {:filename => fname,
67 {:filename => fname,
65 :type => 'text/plain'})
68 :type => 'text/plain'})
66 else
69 else
67 flash[:notice] = 'Error viewing source'
70 flash[:notice] = 'Error viewing source'
68 redirect_to :action => 'list'
71 redirect_to :action => 'list'
69 end
72 end
70 end
73 end
71
74
72 def compiler_msg
75 def compiler_msg
73 @submission = Submission.find(params[:id])
76 @submission = Submission.find(params[:id])
74 if @submission.user_id == session[:user_id]
77 if @submission.user_id == session[:user_id]
75 render :action => 'compiler_msg', :layout => 'empty'
78 render :action => 'compiler_msg', :layout => 'empty'
76 else
79 else
77 flash[:notice] = 'Error viewing source'
80 flash[:notice] = 'Error viewing source'
78 redirect_to :action => 'list'
81 redirect_to :action => 'list'
79 end
82 end
80 end
83 end
81
84
82 def submission
85 def submission
83 @user = User.find(session[:user_id])
86 @user = User.find(session[:user_id])
84 @problems = Problem.find_available_problems
87 @problems = Problem.find_available_problems
@@ -1,134 +1,147
1 class Submission < ActiveRecord::Base
1 class Submission < ActiveRecord::Base
2
2
3 belongs_to :language
3 belongs_to :language
4 belongs_to :problem
4 belongs_to :problem
5 belongs_to :user
5 belongs_to :user
6
6
7 + before_validation :assign_problem
8 + before_validation :assign_language
9 +
7 validates_presence_of :source
10 validates_presence_of :source
8 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 => 'too long'
9 validates_length_of :source, :minimum => 1, :allow_blank => true, :message => 'too short'
12 validates_length_of :source, :minimum => 1, :allow_blank => true, :message => 'too short'
13 + validate :must_have_valid_problem
10 validate :must_specify_language
14 validate :must_specify_language
11 - validate :must_have_valid_problem
12
15
13 before_save :assign_latest_number_if_new_recond
16 before_save :assign_latest_number_if_new_recond
14
17
15 def self.find_last_by_user_and_problem(user_id, problem_id)
18 def self.find_last_by_user_and_problem(user_id, problem_id)
16 last_sub = find(:first,
19 last_sub = find(:first,
17 :conditions => {:user_id => user_id,
20 :conditions => {:user_id => user_id,
18 :problem_id => problem_id},
21 :problem_id => problem_id},
19 :order => 'number DESC')
22 :order => 'number DESC')
20 return last_sub
23 return last_sub
21 end
24 end
22
25
23 def self.find_all_last_by_problem(problem_id)
26 def self.find_all_last_by_problem(problem_id)
24 # need to put in SQL command, maybe there's a better way
27 # need to put in SQL command, maybe there's a better way
25 Submission.find_by_sql("SELECT * FROM submissions " +
28 Submission.find_by_sql("SELECT * FROM submissions " +
26 "WHERE id = " +
29 "WHERE id = " +
27 "(SELECT MAX(id) FROM submissions AS subs " +
30 "(SELECT MAX(id) FROM submissions AS subs " +
28 "WHERE subs.user_id = submissions.user_id AND " +
31 "WHERE subs.user_id = submissions.user_id AND " +
29 "problem_id = " + problem_id.to_s + " " +
32 "problem_id = " + problem_id.to_s + " " +
30 "GROUP BY user_id)")
33 "GROUP BY user_id)")
31 end
34 end
32
35
33 def self.find_last_for_all_available_problems(user_id)
36 def self.find_last_for_all_available_problems(user_id)
34 submissions = Array.new
37 submissions = Array.new
35 problems = Problem.find_available_problems
38 problems = Problem.find_available_problems
36 problems.each do |problem|
39 problems.each do |problem|
37 sub = Submission.find_last_by_user_and_problem(user_id, problem.id)
40 sub = Submission.find_last_by_user_and_problem(user_id, problem.id)
38 submissions << sub if sub!=nil
41 submissions << sub if sub!=nil
39 end
42 end
40 submissions
43 submissions
41 end
44 end
42
45
43 def self.find_by_user_problem_number(user_id, problem_id, number)
46 def self.find_by_user_problem_number(user_id, problem_id, number)
44 Submission.find(:first,
47 Submission.find(:first,
45 :conditions => {
48 :conditions => {
46 :user_id => user_id,
49 :user_id => user_id,
47 :problem_id => problem_id,
50 :problem_id => problem_id,
48 :number => number
51 :number => number
49 })
52 })
50 end
53 end
51
54
52 def self.find_all_by_user_problem(user_id, problem_id)
55 def self.find_all_by_user_problem(user_id, problem_id)
53 Submission.find(:all,
56 Submission.find(:all,
54 :conditions => {
57 :conditions => {
55 :user_id => user_id,
58 :user_id => user_id,
56 :problem_id => problem_id,
59 :problem_id => problem_id,
57 })
60 })
58 end
61 end
59
62
60 protected
63 protected
61
64
62 def self.find_option_in_source(option, source)
65 def self.find_option_in_source(option, source)
63 if source==nil
66 if source==nil
64 return nil
67 return nil
65 end
68 end
66 i = 0
69 i = 0
67 source.each_line do |s|
70 source.each_line do |s|
68 if s =~ option
71 if s =~ option
69 words = s.split
72 words = s.split
70 return words[1]
73 return words[1]
71 end
74 end
72 i = i + 1
75 i = i + 1
73 if i==10
76 if i==10
74 return nil
77 return nil
75 end
78 end
76 end
79 end
77 return nil
80 return nil
78 end
81 end
79
82
80 def self.find_language_in_source(source)
83 def self.find_language_in_source(source)
81 langopt = find_option_in_source(/^LANG:/,source)
84 langopt = find_option_in_source(/^LANG:/,source)
82 if language = Language.find_by_name(langopt)
85 if language = Language.find_by_name(langopt)
83 return language
86 return language
84 elsif language = Language.find_by_pretty_name(langopt)
87 elsif language = Language.find_by_pretty_name(langopt)
85 return language
88 return language
86 else
89 else
87 return nil
90 return nil
88 end
91 end
89 end
92 end
90
93
91 def self.find_problem_in_source(source)
94 def self.find_problem_in_source(source)
92 prob_opt = find_option_in_source(/^TASK:/,source)
95 prob_opt = find_option_in_source(/^TASK:/,source)
93 if problem = Problem.find_by_name(prob_opt)
96 if problem = Problem.find_by_name(prob_opt)
94 return problem
97 return problem
95 else
98 else
96 return nil
99 return nil
97 end
100 end
98 end
101 end
99
102
103 + def assign_problem
104 + if self.problem_id!=-1
105 + begin
106 + self.problem = Problem.find(self.problem_id)
107 + rescue ActiveRecord::RecordNotFound
108 + self.problem = nil
109 + end
110 + else
111 + self.problem = Submission.find_problem_in_source(self.source)
112 + end
113 + end
114 +
115 + def assign_language
116 + self.language = Submission.find_language_in_source(self.source)
117 + end
118 +
100 # validation codes
119 # validation codes
101 def must_specify_language
120 def must_specify_language
102 return if self.source==nil
121 return if self.source==nil
103 - self.language = Submission.find_language_in_source(self.source)
122 +
104 - errors.add('source',"must specify programming language") unless self.language!=nil
123 + # for output_only tasks
124 + return if self.problem!=nil and self.problem.output_only
125 +
126 + if self.language==nil
127 + errors.add('source',"must specify programming language") unless self.language!=nil
128 + end
105 end
129 end
106
130
107 def must_have_valid_problem
131 def must_have_valid_problem
108 return if self.source==nil
132 return if self.source==nil
109 - if self.problem_id!=-1
133 + if self.problem==nil
110 - begin
111 - problem = Problem.find(self.problem_id)
112 - rescue ActiveRecord::RecordNotFound
113 - problem = nil
114 - end
115 - else
116 - problem = Submission.find_problem_in_source(self.source)
117 - end
118 - if problem==nil
119 errors.add('problem',"must be specified.")
134 errors.add('problem',"must be specified.")
120 - elsif (!problem.available) and (self.new_record?)
135 + elsif (!self.problem.available) and (self.new_record?)
121 errors.add('problem',"must be valid.")
136 errors.add('problem',"must be valid.")
122 - else
123 - self.problem = problem
124 end
137 end
125 end
138 end
126
139
127 # callbacks
140 # callbacks
128 def assign_latest_number_if_new_recond
141 def assign_latest_number_if_new_recond
129 return if !self.new_record?
142 return if !self.new_record?
130 latest = Submission.find_last_by_user_and_problem(self.user_id, self.problem_id)
143 latest = Submission.find_last_by_user_and_problem(self.user_id, self.problem_id)
131 self.number = (latest==nil) ? 1 : latest.number + 1;
144 self.number = (latest==nil) ? 1 : latest.number + 1;
132 end
145 end
133
146
134 end
147 end
@@ -1,38 +1,52
1 <%= error_messages_for 'problem' %>
1 <%= error_messages_for 'problem' %>
2
2
3 <!--[form:problem]-->
3 <!--[form:problem]-->
4 <p><label for="problem_name">Name</label><br/>
4 <p><label for="problem_name">Name</label><br/>
5 <%= text_field 'problem', 'name' %></p>
5 <%= text_field 'problem', 'name' %></p>
6
6
7 <p><label for="problem_full_name">Full name</label><br/>
7 <p><label for="problem_full_name">Full name</label><br/>
8 <%= text_field 'problem', 'full_name' %></p>
8 <%= text_field 'problem', 'full_name' %></p>
9
9
10 <p><label for="problem_full_score">Full score</label><br/>
10 <p><label for="problem_full_score">Full score</label><br/>
11 <%= text_field 'problem', 'full_score' %></p>
11 <%= text_field 'problem', 'full_score' %></p>
12
12
13 <p><label for="problem_date_added">Date added</label><br/>
13 <p><label for="problem_date_added">Date added</label><br/>
14 <%= date_select 'problem', 'date_added' %></p>
14 <%= date_select 'problem', 'date_added' %></p>
15
15
16 - <p><label for="problem_available">Available?</label>
16 + <%
17 - <%= select("problem","available",[['True',true],['False',false]]) %></p>
17 + # TODO: these should be put in model Problem, but I can't think of
18 + # nice default values for them. These values look fine only
19 + # in this case (of lazily adding new problems).
20 + @problem.available = true if @problem!=nil and @problem.available==nil
21 + @problem.test_allowed = true if @problem!=nil and @problem.test_allowed==nil
22 + @problem.output_only = false if @problem!=nil and @problem.output_only==nil
23 + %>
18
24
19 - <p><label for="problem_test_allowed">Test allowed?</label>
25 + <p>
20 - <%= select("problem","test_allowed",[['True',true],['False',false]]) %></p>
26 + <label for="problem_available">Available?</label>
27 + <%= check_box :problem, :available %>
28 +
29 + <label for="problem_test_allowed">Test allowed?</label>
30 + <%= check_box :problem, :test_allowed %>
31 +
32 + <label for="problem_output_only">Output only?</label>
33 + <%= check_box :problem, :output_only %>
34 + </p>
21
35
22 <%= error_messages_for 'description' %>
36 <%= error_messages_for 'description' %>
23
37
24 <p><label for="description_body">Description</label><br/>
38 <p><label for="description_body">Description</label><br/>
25 <%= text_area :description, :body, :rows => 10, :cols => 80 %></p>
39 <%= text_area :description, :body, :rows => 10, :cols => 80 %></p>
26
40
27 <p><label for="description_markdowned">Markdowned?</label>
41 <p><label for="description_markdowned">Markdowned?</label>
28 <%= select "description",
42 <%= select "description",
29 "markdowned",
43 "markdowned",
30 [['True',true],['False',false]],
44 [['True',true],['False',false]],
31 {:selected => (@description) ? @description.markdowned : false }
45 {:selected => (@description) ? @description.markdowned : false }
32 %></p>
46 %></p>
33
47
34 <p><label for="problem_url">URL</label><br/>
48 <p><label for="problem_url">URL</label><br/>
35 <%= text_field 'problem', 'url' %></p>
49 <%= text_field 'problem', 'url' %></p>
36
50
37
51
38 <!--[eoform:problem]-->
52 <!--[eoform:problem]-->
@@ -1,166 +1,168
1 # This file is auto-generated from the current state of the database. Instead of editing this file,
1 # This file is auto-generated from the current state of the database. Instead of editing this file,
2 # please use the migrations feature of ActiveRecord to incrementally modify your database, and
2 # please use the migrations feature of ActiveRecord to incrementally modify your database, and
3 # then regenerate this schema definition.
3 # then regenerate this schema definition.
4 #
4 #
5 # Note that this schema.rb definition is the authoritative source for your database schema. If you need
5 # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6 # to create the application database on another system, you should be using db:schema:load, not running
6 # to create the application database on another system, you should be using db:schema:load, not running
7 # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
7 # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8 # you'll amass, the slower it'll run and the greater likelihood for issues).
8 # you'll amass, the slower it'll run and the greater likelihood for issues).
9 #
9 #
10 # It's strongly recommended to check this file into your version control system.
10 # It's strongly recommended to check this file into your version control system.
11
11
12 - ActiveRecord::Schema.define(:version => 30) do
12 + ActiveRecord::Schema.define(:version => 31) do
13
13
14 create_table "announcements", :force => true do |t|
14 create_table "announcements", :force => true do |t|
15 t.string "author"
15 t.string "author"
16 t.text "body"
16 t.text "body"
17 t.boolean "published"
17 t.boolean "published"
18 t.datetime "created_at"
18 t.datetime "created_at"
19 t.datetime "updated_at"
19 t.datetime "updated_at"
20 end
20 end
21
21
22 create_table "configurations", :force => true do |t|
22 create_table "configurations", :force => true do |t|
23 t.string "key"
23 t.string "key"
24 t.string "value_type"
24 t.string "value_type"
25 t.string "value"
25 t.string "value"
26 t.datetime "created_at"
26 t.datetime "created_at"
27 t.datetime "updated_at"
27 t.datetime "updated_at"
28 end
28 end
29
29
30 create_table "descriptions", :force => true do |t|
30 create_table "descriptions", :force => true do |t|
31 t.text "body"
31 t.text "body"
32 t.boolean "markdowned"
32 t.boolean "markdowned"
33 t.datetime "created_at"
33 t.datetime "created_at"
34 t.datetime "updated_at"
34 t.datetime "updated_at"
35 end
35 end
36
36
37 create_table "grader_processes", :force => true do |t|
37 create_table "grader_processes", :force => true do |t|
38 t.string "host", :limit => 20
38 t.string "host", :limit => 20
39 t.integer "pid"
39 t.integer "pid"
40 t.string "mode"
40 t.string "mode"
41 t.boolean "active"
41 t.boolean "active"
42 t.datetime "created_at"
42 t.datetime "created_at"
43 t.datetime "updated_at"
43 t.datetime "updated_at"
44 t.integer "task_id"
44 t.integer "task_id"
45 end
45 end
46
46
47 add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid"
47 add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid"
48
48
49 create_table "languages", :force => true do |t|
49 create_table "languages", :force => true do |t|
50 t.string "name", :limit => 10
50 t.string "name", :limit => 10
51 t.string "pretty_name"
51 t.string "pretty_name"
52 t.string "ext", :limit => 10
52 t.string "ext", :limit => 10
53 end
53 end
54
54
55 create_table "problems", :force => true do |t|
55 create_table "problems", :force => true do |t|
56 t.string "name", :limit => 30
56 t.string "name", :limit => 30
57 t.string "full_name"
57 t.string "full_name"
58 t.integer "full_score"
58 t.integer "full_score"
59 t.date "date_added"
59 t.date "date_added"
60 t.boolean "available"
60 t.boolean "available"
61 t.string "url"
61 t.string "url"
62 t.integer "description_id"
62 t.integer "description_id"
63 t.boolean "test_allowed"
63 t.boolean "test_allowed"
64 + t.boolean "output_only"
64 end
65 end
65
66
66 create_table "rights", :force => true do |t|
67 create_table "rights", :force => true do |t|
67 t.string "name"
68 t.string "name"
68 t.string "controller"
69 t.string "controller"
69 t.string "action"
70 t.string "action"
70 end
71 end
71
72
72 create_table "rights_roles", :id => false, :force => true do |t|
73 create_table "rights_roles", :id => false, :force => true do |t|
73 t.integer "right_id"
74 t.integer "right_id"
74 t.integer "role_id"
75 t.integer "role_id"
75 end
76 end
76
77
77 add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id"
78 add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id"
78
79
79 create_table "roles", :force => true do |t|
80 create_table "roles", :force => true do |t|
80 t.string "name"
81 t.string "name"
81 end
82 end
82
83
83 create_table "roles_users", :id => false, :force => true do |t|
84 create_table "roles_users", :id => false, :force => true do |t|
84 t.integer "role_id"
85 t.integer "role_id"
85 t.integer "user_id"
86 t.integer "user_id"
86 end
87 end
87
88
88 add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id"
89 add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id"
89
90
90 create_table "sessions", :force => true do |t|
91 create_table "sessions", :force => true do |t|
91 t.string "session_id"
92 t.string "session_id"
92 t.text "data"
93 t.text "data"
93 t.datetime "updated_at"
94 t.datetime "updated_at"
94 end
95 end
95
96
96 add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
97 add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
97 add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
98 add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
98
99
99 create_table "sites", :force => true do |t|
100 create_table "sites", :force => true do |t|
100 t.string "name"
101 t.string "name"
101 t.boolean "started"
102 t.boolean "started"
102 t.datetime "start_time"
103 t.datetime "start_time"
103 t.datetime "created_at"
104 t.datetime "created_at"
104 t.datetime "updated_at"
105 t.datetime "updated_at"
105 end
106 end
106
107
107 create_table "submissions", :force => true do |t|
108 create_table "submissions", :force => true do |t|
108 t.integer "user_id"
109 t.integer "user_id"
109 t.integer "problem_id"
110 t.integer "problem_id"
110 t.integer "language_id"
111 t.integer "language_id"
111 t.text "source"
112 t.text "source"
112 t.binary "binary"
113 t.binary "binary"
113 t.datetime "submitted_at"
114 t.datetime "submitted_at"
114 t.datetime "compiled_at"
115 t.datetime "compiled_at"
115 t.text "compiler_message"
116 t.text "compiler_message"
116 t.datetime "graded_at"
117 t.datetime "graded_at"
117 t.integer "points"
118 t.integer "points"
118 t.text "grader_comment"
119 t.text "grader_comment"
119 t.integer "number"
120 t.integer "number"
121 + t.string "source_filename"
120 end
122 end
121
123
122 add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true
124 add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true
123 add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id"
125 add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id"
124
126
125 create_table "tasks", :force => true do |t|
127 create_table "tasks", :force => true do |t|
126 t.integer "submission_id"
128 t.integer "submission_id"
127 t.datetime "created_at"
129 t.datetime "created_at"
128 t.integer "status"
130 t.integer "status"
129 t.datetime "updated_at"
131 t.datetime "updated_at"
130 end
132 end
131
133
132 create_table "test_requests", :force => true do |t|
134 create_table "test_requests", :force => true do |t|
133 t.integer "user_id"
135 t.integer "user_id"
134 t.integer "problem_id"
136 t.integer "problem_id"
135 t.integer "submission_id"
137 t.integer "submission_id"
136 t.string "input_file_name"
138 t.string "input_file_name"
137 t.string "output_file_name"
139 t.string "output_file_name"
138 t.string "running_stat"
140 t.string "running_stat"
139 t.integer "status"
141 t.integer "status"
140 t.datetime "updated_at"
142 t.datetime "updated_at"
141 t.datetime "submitted_at"
143 t.datetime "submitted_at"
142 t.datetime "compiled_at"
144 t.datetime "compiled_at"
143 t.text "compiler_message"
145 t.text "compiler_message"
144 t.datetime "graded_at"
146 t.datetime "graded_at"
145 t.string "grader_comment"
147 t.string "grader_comment"
146 t.datetime "created_at"
148 t.datetime "created_at"
147 t.float "running_time"
149 t.float "running_time"
148 t.string "exit_status"
150 t.string "exit_status"
149 t.integer "memory_usage"
151 t.integer "memory_usage"
150 end
152 end
151
153
152 add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id"
154 add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id"
153
155
154 create_table "users", :force => true do |t|
156 create_table "users", :force => true do |t|
155 t.string "login", :limit => 10
157 t.string "login", :limit => 10
156 t.string "full_name"
158 t.string "full_name"
157 t.string "hashed_password"
159 t.string "hashed_password"
158 t.string "salt", :limit => 5
160 t.string "salt", :limit => 5
159 t.string "alias"
161 t.string "alias"
160 t.string "email"
162 t.string "email"
161 t.integer "site_id"
163 t.integer "site_id"
162 end
164 end
163
165
164 add_index "users", ["login"], :name => "index_users_on_login", :unique => true
166 add_index "users", ["login"], :name => "index_users_on_login", :unique => true
165
167
166 end
168 end
You need to be logged in to leave comments. Login now