Description:
add rejudge button
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r645:a2d233431d60 - - 8 files changed: 64 inserted, 32 deleted

@@ -0,0 +1,2
1 + :plain
2 + $("body").prepend("<div class=\"alert alert-info\"> Submission #{@submission.id}'s task status has been chaned to \"#{@task.status_str}\" </div>")
@@ -0,0 +1,5
1 + class AddIndexToTask < ActiveRecord::Migration
2 + def change
3 + add_index :tasks, :submission_id
4 + end
5 + end
@@ -1,96 +1,109
1 class SubmissionsController < ApplicationController
1 class SubmissionsController < ApplicationController
2 - before_filter :authenticate
2 + before_action :authenticate
3 - before_filter :submission_authorization, only: [:show, :direct_edit_submission, :download, :edit]
3 + before_action :submission_authorization, only: [:show, :direct_edit_submission, :download, :edit]
4 + before_action :admin_authorization, only: [:rejudge]
4
5
5 # GET /submissions
6 # GET /submissions
6 # GET /submissions.json
7 # GET /submissions.json
7 # Show problem selection and user's submission of that problem
8 # Show problem selection and user's submission of that problem
8 def index
9 def index
9 @user = @current_user
10 @user = @current_user
10 @problems = @user.available_problems
11 @problems = @user.available_problems
11
12
12 if params[:problem_id]==nil
13 if params[:problem_id]==nil
13 @problem = nil
14 @problem = nil
14 @submissions = nil
15 @submissions = nil
15 else
16 else
16 @problem = Problem.find_by_id(params[:problem_id])
17 @problem = Problem.find_by_id(params[:problem_id])
17 if (@problem == nil) or (not @problem.available)
18 if (@problem == nil) or (not @problem.available)
18 redirect_to main_list_path
19 redirect_to main_list_path
19 flash[:notice] = 'Error: submissions for that problem are not viewable.'
20 flash[:notice] = 'Error: submissions for that problem are not viewable.'
20 return
21 return
21 end
22 end
22 @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id).order(id: :desc)
23 @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id).order(id: :desc)
23 end
24 end
24 end
25 end
25
26
26 # GET /submissions/1
27 # GET /submissions/1
27 # GET /submissions/1.json
28 # GET /submissions/1.json
28 def show
29 def show
29 @submission = Submission.find(params[:id])
30 @submission = Submission.find(params[:id])
30
31
31 #log the viewing
32 #log the viewing
32 user = User.find(session[:user_id])
33 user = User.find(session[:user_id])
33 SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin?
34 SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin?
35 +
36 + @task = @submission.task
34 end
37 end
35
38
36 def download
39 def download
37 @submission = Submission.find(params[:id])
40 @submission = Submission.find(params[:id])
38 send_data(@submission.source, {:filename => @submission.download_filename, :type => 'text/plain'})
41 send_data(@submission.source, {:filename => @submission.download_filename, :type => 'text/plain'})
39 end
42 end
40
43
41 def compiler_msg
44 def compiler_msg
42 @submission = Submission.find(params[:id])
45 @submission = Submission.find(params[:id])
43 respond_to do |format|
46 respond_to do |format|
44 format.js
47 format.js
45 end
48 end
46 end
49 end
47
50
48 #on-site new submission on specific problem
51 #on-site new submission on specific problem
49 def direct_edit_problem
52 def direct_edit_problem
50 @problem = Problem.find(params[:problem_id])
53 @problem = Problem.find(params[:problem_id])
51 @source = ''
54 @source = ''
52 render 'edit'
55 render 'edit'
53 end
56 end
54
57
55 # GET /submissions/1/edit
58 # GET /submissions/1/edit
56 def edit
59 def edit
57 @submission = Submission.find(params[:id])
60 @submission = Submission.find(params[:id])
58 @source = @submission.source.to_s
61 @source = @submission.source.to_s
59 @problem = @submission.problem
62 @problem = @submission.problem
60 @lang_id = @submission.language.id
63 @lang_id = @submission.language.id
61 end
64 end
62
65
63
66
64 def get_latest_submission_status
67 def get_latest_submission_status
65 @problem = Problem.find(params[:pid])
68 @problem = Problem.find(params[:pid])
66 @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid])
69 @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid])
67 puts User.find(params[:uid]).login
70 puts User.find(params[:uid]).login
68 puts Problem.find(params[:pid]).name
71 puts Problem.find(params[:pid]).name
69 puts 'nil' unless @submission
72 puts 'nil' unless @submission
70 respond_to do |format|
73 respond_to do |format|
71 format.js
74 format.js
72 end
75 end
73 end
76 end
74
77
78 + # GET /submissions/:id/rejudge
79 + def rejudge
80 + @submission = Submission.find(params[:id])
81 + @task = @submission.task
82 + @task.status_inqueue! if @task
83 + respond_to do |format|
84 + format.js
85 + end
86 + end
87 +
75
88
76 protected
89 protected
77
90
78 def submission_authorization
91 def submission_authorization
79 #admin always has privileged
92 #admin always has privileged
80 if @current_user.admin?
93 if @current_user.admin?
81 return true
94 return true
82 end
95 end
83
96
84 sub = Submission.find(params[:id])
97 sub = Submission.find(params[:id])
85 if sub.problem.available?
98 if sub.problem.available?
86 puts "sub = #{sub.user.id}, current = #{@current_user.id}"
99 puts "sub = #{sub.user.id}, current = #{@current_user.id}"
87 return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user
100 return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user
88 end
101 end
89
102
90 #default to NO
103 #default to NO
91 unauthorized_redirect
104 unauthorized_redirect
92 return false
105 return false
93 end
106 end
94
107
95
108
96 end
109 end
@@ -116,107 +116,106
116 data: {remote: true, method: 'get'}}
116 data: {remote: true, method: 'get'}}
117 end
117 end
118
118
119 def get_ace_mode(language)
119 def get_ace_mode(language)
120 # return ace mode string from Language
120 # return ace mode string from Language
121
121
122 case language.pretty_name
122 case language.pretty_name
123 when 'Pascal'
123 when 'Pascal'
124 'ace/mode/pascal'
124 'ace/mode/pascal'
125 when 'C++','C'
125 when 'C++','C'
126 'ace/mode/c_cpp'
126 'ace/mode/c_cpp'
127 when 'Ruby'
127 when 'Ruby'
128 'ace/mode/ruby'
128 'ace/mode/ruby'
129 when 'Python'
129 when 'Python'
130 'ace/mode/python'
130 'ace/mode/python'
131 when 'Java'
131 when 'Java'
132 'ace/mode/java'
132 'ace/mode/java'
133 else
133 else
134 'ace/mode/c_cpp'
134 'ace/mode/c_cpp'
135 end
135 end
136 end
136 end
137
137
138
138
139 def user_title_bar(user)
139 def user_title_bar(user)
140 header = ''
140 header = ''
141 time_left = ''
141 time_left = ''
142
142
143 #
143 #
144 # if the contest is over
144 # if the contest is over
145 if GraderConfiguration.time_limit_mode?
145 if GraderConfiguration.time_limit_mode?
146 if user.contest_finished?
146 if user.contest_finished?
147 header = <<CONTEST_OVER
147 header = <<CONTEST_OVER
148 <tr><td colspan="2" align="center">
148 <tr><td colspan="2" align="center">
149 <span class="contest-over-msg">THE CONTEST IS OVER</span>
149 <span class="contest-over-msg">THE CONTEST IS OVER</span>
150 </td></tr>
150 </td></tr>
151 CONTEST_OVER
151 CONTEST_OVER
152 end
152 end
153 if !user.contest_started?
153 if !user.contest_started?
154 time_left = "&nbsp;&nbsp;" + (t 'title_bar.contest_not_started')
154 time_left = "&nbsp;&nbsp;" + (t 'title_bar.contest_not_started')
155 else
155 else
156 time_left = "&nbsp;&nbsp;" + (t 'title_bar.remaining_time') +
156 time_left = "&nbsp;&nbsp;" + (t 'title_bar.remaining_time') +
157 " #{format_short_duration(user.contest_time_left)}"
157 " #{format_short_duration(user.contest_time_left)}"
158 end
158 end
159 end
159 end
160
160
161 #
161 #
162 # if the contest is in the anaysis mode
162 # if the contest is in the anaysis mode
163 if GraderConfiguration.analysis_mode?
163 if GraderConfiguration.analysis_mode?
164 header = <<ANALYSISMODE
164 header = <<ANALYSISMODE
165 <tr><td colspan="2" align="center">
165 <tr><td colspan="2" align="center">
166 <span class="contest-over-msg">ANALYSIS MODE</span>
166 <span class="contest-over-msg">ANALYSIS MODE</span>
167 </td></tr>
167 </td></tr>
168 ANALYSISMODE
168 ANALYSISMODE
169 end
169 end
170
170
171 contest_name = GraderConfiguration['contest.name']
171 contest_name = GraderConfiguration['contest.name']
172
172
173 #
173 #
174 # build real title bar
174 # build real title bar
175 result = <<TITLEBAR
175 result = <<TITLEBAR
176 <div class="title">
176 <div class="title">
177 <table>
177 <table>
178 #{header}
178 #{header}
179 <tr>
179 <tr>
180 <td class="left-col">
180 <td class="left-col">
181 #{user.full_name}<br/>
181 #{user.full_name}<br/>
182 #{t 'title_bar.current_time'} #{format_short_time(Time.zone.now)}
182 #{t 'title_bar.current_time'} #{format_short_time(Time.zone.now)}
183 #{time_left}
183 #{time_left}
184 <br/>
184 <br/>
185 </td>
185 </td>
186 <td class="right-col">#{contest_name}</td>
186 <td class="right-col">#{contest_name}</td>
187 </tr>
187 </tr>
188 </table>
188 </table>
189 </div>
189 </div>
190 TITLEBAR
190 TITLEBAR
191 result.html_safe
191 result.html_safe
192 end
192 end
193
193
194 def markdown(text)
194 def markdown(text)
195 markdown = RDiscount.new(text)
195 markdown = RDiscount.new(text)
196 markdown.to_html.html_safe
196 markdown.to_html.html_safe
197 end
197 end
198
198
199
199
200 BOOTSTRAP_FLASH_MSG = {
200 BOOTSTRAP_FLASH_MSG = {
201 success: 'alert-success',
201 success: 'alert-success',
202 error: 'alert-danger',
202 error: 'alert-danger',
203 alert: 'alert-block',
203 alert: 'alert-block',
204 notice: 'alert-info'
204 notice: 'alert-info'
205 }
205 }
206
206
207 def bootstrap_class_for(flash_type)
207 def bootstrap_class_for(flash_type)
208 BOOTSTRAP_FLASH_MSG.fetch(flash_type.to_sym, flash_type.to_s)
208 BOOTSTRAP_FLASH_MSG.fetch(flash_type.to_sym, flash_type.to_s)
209 end
209 end
210
210
211 def flash_messages
211 def flash_messages
212 - puts "flahs size = #{flash.count}"
213 flash.each do |msg_type, message|
212 flash.each do |msg_type, message|
214 concat(content_tag(:div, message, class: "alert #{bootstrap_class_for(msg_type)} fade in") do
213 concat(content_tag(:div, message, class: "alert #{bootstrap_class_for(msg_type)} fade in") do
215 concat content_tag(:button, 'x', class: "close", data: { dismiss: 'alert' })
214 concat content_tag(:button, 'x', class: "close", data: { dismiss: 'alert' })
216 concat message
215 concat message
217 end)
216 end)
218 end
217 end
219 nil
218 nil
220 end
219 end
221
220
222 end
221 end
@@ -1,111 +1,113
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
7 before_validation :assign_problem
8 before_validation :assign_language
8 before_validation :assign_language
9
9
10 validates_presence_of :source
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 => 'too long'
12 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
13 validate :must_have_valid_problem
14 validate :must_specify_language
14 validate :must_specify_language
15
15
16 + has_one :task
17 +
16 before_save :assign_latest_number_if_new_recond
18 before_save :assign_latest_number_if_new_recond
17
19
18 def self.find_last_by_user_and_problem(user_id, problem_id)
20 def self.find_last_by_user_and_problem(user_id, problem_id)
19 where("user_id = ? AND problem_id = ?",user_id,problem_id).last
21 where("user_id = ? AND problem_id = ?",user_id,problem_id).last
20 end
22 end
21
23
22 def self.find_all_last_by_problem(problem_id)
24 def self.find_all_last_by_problem(problem_id)
23 # need to put in SQL command, maybe there's a better way
25 # need to put in SQL command, maybe there's a better way
24 Submission.includes(:user).find_by_sql("SELECT * FROM submissions " +
26 Submission.includes(:user).find_by_sql("SELECT * FROM submissions " +
25 "WHERE id = " +
27 "WHERE id = " +
26 "(SELECT MAX(id) FROM submissions AS subs " +
28 "(SELECT MAX(id) FROM submissions AS subs " +
27 "WHERE subs.user_id = submissions.user_id AND " +
29 "WHERE subs.user_id = submissions.user_id AND " +
28 "problem_id = " + problem_id.to_s + " " +
30 "problem_id = " + problem_id.to_s + " " +
29 "GROUP BY user_id) " +
31 "GROUP BY user_id) " +
30 "ORDER BY user_id")
32 "ORDER BY user_id")
31 end
33 end
32
34
33 def self.find_in_range_by_user_and_problem(user_id, problem_id,since_id,until_id)
35 def self.find_in_range_by_user_and_problem(user_id, problem_id,since_id,until_id)
34 records = Submission.where(problem_id: problem_id,user_id: user_id)
36 records = Submission.where(problem_id: problem_id,user_id: user_id)
35 records = records.where('id >= ?',since_id) if since_id > 0
37 records = records.where('id >= ?',since_id) if since_id > 0
36 records = records.where('id <= ?',until_id) if until_id > 0
38 records = records.where('id <= ?',until_id) if until_id > 0
37 records.all
39 records.all
38 end
40 end
39
41
40 def self.find_last_for_all_available_problems(user_id)
42 def self.find_last_for_all_available_problems(user_id)
41 submissions = Array.new
43 submissions = Array.new
42 problems = Problem.available_problems
44 problems = Problem.available_problems
43 problems.each do |problem|
45 problems.each do |problem|
44 sub = Submission.find_last_by_user_and_problem(user_id, problem.id)
46 sub = Submission.find_last_by_user_and_problem(user_id, problem.id)
45 submissions << sub if sub!=nil
47 submissions << sub if sub!=nil
46 end
48 end
47 submissions
49 submissions
48 end
50 end
49
51
50 def self.find_by_user_problem_number(user_id, problem_id, number)
52 def self.find_by_user_problem_number(user_id, problem_id, number)
51 where("user_id = ? AND problem_id = ? AND number = ?",user_id,problem_id,number).first
53 where("user_id = ? AND problem_id = ? AND number = ?",user_id,problem_id,number).first
52 end
54 end
53
55
54 def self.find_all_by_user_problem(user_id, problem_id)
56 def self.find_all_by_user_problem(user_id, problem_id)
55 where("user_id = ? AND problem_id = ?",user_id,problem_id)
57 where("user_id = ? AND problem_id = ?",user_id,problem_id)
56 end
58 end
57
59
58 def download_filename
60 def download_filename
59 if self.problem.output_only
61 if self.problem.output_only
60 return self.source_filename
62 return self.source_filename
61 else
63 else
62 timestamp = self.submitted_at.localtime.strftime("%H%M%S")
64 timestamp = self.submitted_at.localtime.strftime("%H%M%S")
63 return "#{self.problem.name}-#{timestamp}.#{self.language.ext}"
65 return "#{self.problem.name}-#{timestamp}.#{self.language.ext}"
64 end
66 end
65 end
67 end
66
68
67 protected
69 protected
68
70
69 def self.find_option_in_source(option, source)
71 def self.find_option_in_source(option, source)
70 if source==nil
72 if source==nil
71 return nil
73 return nil
72 end
74 end
73 i = 0
75 i = 0
74 source.each_line do |s|
76 source.each_line do |s|
75 if s =~ option
77 if s =~ option
76 words = s.split
78 words = s.split
77 return words[1]
79 return words[1]
78 end
80 end
79 i = i + 1
81 i = i + 1
80 if i==10
82 if i==10
81 return nil
83 return nil
82 end
84 end
83 end
85 end
84 return nil
86 return nil
85 end
87 end
86
88
87 def self.find_language_in_source(source, source_filename="")
89 def self.find_language_in_source(source, source_filename="")
88 langopt = find_option_in_source(/^LANG:/,source)
90 langopt = find_option_in_source(/^LANG:/,source)
89 if langopt
91 if langopt
90 return (Language.find_by_name(langopt) ||
92 return (Language.find_by_name(langopt) ||
91 Language.find_by_pretty_name(langopt))
93 Language.find_by_pretty_name(langopt))
92 else
94 else
93 if source_filename
95 if source_filename
94 return Language.find_by_extension(source_filename.split('.').last)
96 return Language.find_by_extension(source_filename.split('.').last)
95 else
97 else
96 return nil
98 return nil
97 end
99 end
98 end
100 end
99 end
101 end
100
102
101 def self.find_problem_in_source(source, source_filename="")
103 def self.find_problem_in_source(source, source_filename="")
102 prob_opt = find_option_in_source(/^TASK:/,source)
104 prob_opt = find_option_in_source(/^TASK:/,source)
103 if problem = Problem.find_by_name(prob_opt)
105 if problem = Problem.find_by_name(prob_opt)
104 return problem
106 return problem
105 else
107 else
106 if source_filename
108 if source_filename
107 return Problem.find_by_name(source_filename.split('.').first)
109 return Problem.find_by_name(source_filename.split('.').first)
108 else
110 else
109 return nil
111 return nil
110 end
112 end
111 end
113 end
@@ -1,104 +1,112
1 %h1= "Submission: #{@submission.id}"
1 %h1= "Submission: #{@submission.id}"
2
2
3 %textarea#data{style: "display:none;"}
3 %textarea#data{style: "display:none;"}
4 :preserve
4 :preserve
5 #{@submission.source}
5 #{@submission.source}
6
6
7 //%div.highlight{:style => "border: 1px solid black;"}
7 //%div.highlight{:style => "border: 1px solid black;"}
8 //=@formatted_code.html_safe
8 //=@formatted_code.html_safe
9
9
10
10
11 .containter
11 .containter
12 .row
12 .row
13 .col-md-7
13 .col-md-7
14 %h2 Source Code
14 %h2 Source Code
15 .col-md-5
15 .col-md-5
16 %h2 Stat
16 %h2 Stat
17 .row
17 .row
18 .col-md-7
18 .col-md-7
19 %div#editor{ style: "font-size: 14px; height: 400px; border-radius:5px;" }
19 %div#editor{ style: "font-size: 14px; height: 400px; border-radius:5px;" }
20 :javascript
20 :javascript
21 e = ace.edit("editor")
21 e = ace.edit("editor")
22 e.setOptions({ maxLines: Infinity })
22 e.setOptions({ maxLines: Infinity })
23 e.setValue($("#data").text())
23 e.setValue($("#data").text())
24 e.gotoLine(1)
24 e.gotoLine(1)
25 e.getSession().setMode("#{get_ace_mode(@submission.language)}")
25 e.getSession().setMode("#{get_ace_mode(@submission.language)}")
26 e.setReadOnly(true)
26 e.setReadOnly(true)
27 .col-md-5
27 .col-md-5
28 %table.table.table-striped
28 %table.table.table-striped
29 %tr
29 %tr
30 %td.text-right
30 %td.text-right
31 %strong User
31 %strong User
32 %td
32 %td
33 - if @submission.user
33 - if @submission.user
34 = link_to "#{@submission.user.login}", stat_user_path(@submission.user)
34 = link_to "#{@submission.user.login}", stat_user_path(@submission.user)
35 = @submission.user.full_name
35 = @submission.user.full_name
36 - else
36 - else
37 = "(n/a)"
37 = "(n/a)"
38 %tr
38 %tr
39 %td.text-right
39 %td.text-right
40 %strong Task
40 %strong Task
41 %td
41 %td
42 - if @submission.problem!=nil
42 - if @submission.problem!=nil
43 = link_to "[#{@submission.problem.name}]", stat_problem_path(@submission.problem)
43 = link_to "[#{@submission.problem.name}]", stat_problem_path(@submission.problem)
44 = @submission.problem.full_name
44 = @submission.problem.full_name
45 - else
45 - else
46 = "(n/a)"
46 = "(n/a)"
47 %tr
47 %tr
48 %td.text-right
48 %td.text-right
49 %strong Tries
49 %strong Tries
50 %td= @submission.number
50 %td= @submission.number
51 %tr
51 %tr
52 %td.text-right
52 %td.text-right
53 %strong Language
53 %strong Language
54 %td= @submission.language.pretty_name
54 %td= @submission.language.pretty_name
55 %tr
55 %tr
56 %td.text-right
56 %td.text-right
57 %strong Submitted
57 %strong Submitted
58 %td #{time_ago_in_words(@submission.submitted_at)} ago (at #{@submission.submitted_at.to_formatted_s(:long)})
58 %td #{time_ago_in_words(@submission.submitted_at)} ago (at #{@submission.submitted_at.to_formatted_s(:long)})
59 %tr
59 %tr
60 %td.text-right
60 %td.text-right
61 %strong Graded
61 %strong Graded
62 - if @submission.graded_at
62 - if @submission.graded_at
63 %td #{time_ago_in_words(@submission.graded_at)} ago (at #{@submission.graded_at.to_formatted_s(:long)})
63 %td #{time_ago_in_words(@submission.graded_at)} ago (at #{@submission.graded_at.to_formatted_s(:long)})
64 - else
64 - else
65 %td -
65 %td -
66 %tr
66 %tr
67 %td.text-right
67 %td.text-right
68 %strong Points
68 %strong Points
69 %td #{@submission.points}/#{@submission.problem.full_score}
69 %td #{@submission.points}/#{@submission.problem.full_score}
70 %tr
70 %tr
71 %td.text-right
71 %td.text-right
72 %strong Comment
72 %strong Comment
73 %td #{@submission.grader_comment}
73 %td #{@submission.grader_comment}
74 %tr
74 %tr
75 %td.text-right
75 %td.text-right
76 %strong Runtime (s)
76 %strong Runtime (s)
77 %td #{@submission.max_runtime}
77 %td #{@submission.max_runtime}
78 %tr
78 %tr
79 %td.text-right
79 %td.text-right
80 %strong Memory (kb)
80 %strong Memory (kb)
81 %td #{@submission.peak_memory}
81 %td #{@submission.peak_memory}
82 %tr
82 %tr
83 %td.text-right
83 %td.text-right
84 %strong Compiler result
84 %strong Compiler result
85 %td
85 %td
86 %button.btn.btn-info.btn-xs{type: 'button', data: {toggle: 'modal', target: '#compiler'}}
86 %button.btn.btn-info.btn-xs{type: 'button', data: {toggle: 'modal', target: '#compiler'}}
87 view
87 view
88 - if session[:admin]
88 - if session[:admin]
89 %tr
89 %tr
90 %td.text-right
90 %td.text-right
91 %strong IP
91 %strong IP
92 %td #{@submission.ip_address}
92 %td #{@submission.ip_address}
93 + %tr
94 + %td.text-right
95 + %strong Grading Task Status
96 + %td
97 + = @task.status_str if @task
98 + - if session[:admin]
99 + = link_to "rejudge", rejudge_submission_path, data: {remote: true}, class: 'btn btn-info btn-xs'
100 +
93
101
94 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
102 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
95 .modal-dialog.modal-lg{role:'document'}
103 .modal-dialog.modal-lg{role:'document'}
96 .modal-content
104 .modal-content
97 .modal-header
105 .modal-header
98 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
106 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
99 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
107 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
100 %h4 Compiler message
108 %h4 Compiler message
101 .modal-body
109 .modal-body
102 %pre#compiler_msg= @submission.compiler_message
110 %pre#compiler_msg= @submission.compiler_message
103 .modal-footer
111 .modal-footer
104 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
112 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
@@ -1,99 +1,100
1 CafeGrader::Application.routes.draw do
1 CafeGrader::Application.routes.draw do
2 get "sources/direct_edit"
2 get "sources/direct_edit"
3
3
4 root :to => 'main#login'
4 root :to => 'main#login'
5
5
6 #logins
6 #logins
7 get 'login/login', to: 'login#login'
7 get 'login/login', to: 'login#login'
8
8
9 resources :contests
9 resources :contests
10
10
11 resources :sites
11 resources :sites
12
12
13 resources :announcements do
13 resources :announcements do
14 member do
14 member do
15 get 'toggle','toggle_front'
15 get 'toggle','toggle_front'
16 end
16 end
17 end
17 end
18
18
19 resources :problems do
19 resources :problems do
20 member do
20 member do
21 get 'toggle'
21 get 'toggle'
22 get 'toggle_test'
22 get 'toggle_test'
23 get 'toggle_view_testcase'
23 get 'toggle_view_testcase'
24 get 'stat'
24 get 'stat'
25 end
25 end
26 collection do
26 collection do
27 get 'turn_all_off'
27 get 'turn_all_off'
28 get 'turn_all_on'
28 get 'turn_all_on'
29 get 'import'
29 get 'import'
30 get 'manage'
30 get 'manage'
31 end
31 end
32
32
33 end
33 end
34
34
35 resources :testcases, only: [] do
35 resources :testcases, only: [] do
36 member do
36 member do
37 get 'download_input'
37 get 'download_input'
38 get 'download_sol'
38 get 'download_sol'
39 end
39 end
40 collection do
40 collection do
41 get 'show_problem/:problem_id(/:test_num)' => 'testcases#show_problem', as: 'show_problem'
41 get 'show_problem/:problem_id(/:test_num)' => 'testcases#show_problem', as: 'show_problem'
42 end
42 end
43 end
43 end
44
44
45 resources :grader_configuration, controller: 'configurations'
45 resources :grader_configuration, controller: 'configurations'
46
46
47 resources :users do
47 resources :users do
48 member do
48 member do
49 get 'toggle_activate', 'toggle_enable'
49 get 'toggle_activate', 'toggle_enable'
50 get 'stat'
50 get 'stat'
51 end
51 end
52 end
52 end
53
53
54 resources :submissions do
54 resources :submissions do
55 member do
55 member do
56 get 'download'
56 get 'download'
57 get 'compiler_msg'
57 get 'compiler_msg'
58 + get 'rejudge'
58 end
59 end
59 collection do
60 collection do
60 get 'prob/:problem_id', to: 'submissions#index', as: 'problem'
61 get 'prob/:problem_id', to: 'submissions#index', as: 'problem'
61 get 'direct_edit_problem/:problem_id', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem'
62 get 'direct_edit_problem/:problem_id', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem'
62 get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status'
63 get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status'
63 end
64 end
64 end
65 end
65
66
66
67
67
68
68 #main
69 #main
69 get "main/list"
70 get "main/list"
70 get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission'
71 get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission'
71
72
72 #user admin
73 #user admin
73 get 'user_admin/bulk_manage', to: 'user_admin#bulk_manage', as: 'bulk_manage_user_admin'
74 get 'user_admin/bulk_manage', to: 'user_admin#bulk_manage', as: 'bulk_manage_user_admin'
74
75
75 #report
76 #report
76 get 'report/current_score', to: 'report#current_score', as: 'report_current_score'
77 get 'report/current_score', to: 'report#current_score', as: 'report_current_score'
77 get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof'
78 get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof'
78 get "report/login"
79 get "report/login"
79 get 'report/max_score', to: 'report#max_score', as: 'report_max_score'
80 get 'report/max_score', to: 'report#max_score', as: 'report_max_score'
80 post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score'
81 post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score'
81
82
82
83
83 #
84 #
84 get 'tasks/view/:file.:ext' => 'tasks#view'
85 get 'tasks/view/:file.:ext' => 'tasks#view'
85 get 'tasks/download/:id/:file.:ext' => 'tasks#download'
86 get 'tasks/download/:id/:file.:ext' => 'tasks#download'
86 get 'heartbeat/:id/edit' => 'heartbeat#edit'
87 get 'heartbeat/:id/edit' => 'heartbeat#edit'
87
88
88 #grader
89 #grader
89 get 'graders/list', to: 'graders#list', as: 'grader_list'
90 get 'graders/list', to: 'graders#list', as: 'grader_list'
90
91
91
92
92 get 'heartbeat/:id/edit' => 'heartbeat#edit'
93 get 'heartbeat/:id/edit' => 'heartbeat#edit'
93
94
94 # See how all your routes lay out with "rake routes"
95 # See how all your routes lay out with "rake routes"
95
96
96 # This is a legacy wild controller route that's not recommended for RESTful applications.
97 # This is a legacy wild controller route that's not recommended for RESTful applications.
97 # Note: This route will make all actions in every controller accessible via GET requests.
98 # Note: This route will make all actions in every controller accessible via GET requests.
98 match ':controller(/:action(/:id))(.:format)', via: [:get, :post]
99 match ':controller(/:action(/:id))(.:format)', via: [:get, :post]
99 end
100 end
@@ -1,281 +1,283
1 # encoding: UTF-8
1 # encoding: UTF-8
2 # This file is auto-generated from the current state of the database. Instead
2 # This file is auto-generated from the current state of the database. Instead
3 # of editing this file, please use the migrations feature of Active Record to
3 # of editing this file, please use the migrations feature of Active Record to
4 # incrementally modify your database, and then regenerate this schema definition.
4 # incrementally modify your database, and then regenerate this schema definition.
5 #
5 #
6 # Note that this schema.rb definition is the authoritative source for your
6 # Note that this schema.rb definition is the authoritative source for your
7 # database schema. If you need to create the application database on another
7 # database schema. If you need to create the application database on another
8 # system, you should be using db:schema:load, not running all the migrations
8 # system, you should be using db:schema:load, not running all the migrations
9 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 # you'll amass, the slower it'll run and the greater likelihood for issues).
10 # you'll amass, the slower it'll run and the greater likelihood for issues).
11 #
11 #
12 # It's strongly recommended that you check this file into your version control system.
12 # It's strongly recommended that you check this file into your version control system.
13
13
14 - ActiveRecord::Schema.define(version: 20170124024527) do
14 + ActiveRecord::Schema.define(version: 20170310110146) do
15
15
16 create_table "announcements", force: :cascade do |t|
16 create_table "announcements", force: :cascade do |t|
17 t.string "author", limit: 255
17 t.string "author", limit: 255
18 - t.text "body", limit: 16777215
18 + t.text "body", limit: 65535
19 t.boolean "published"
19 t.boolean "published"
20 - t.datetime "created_at", null: false
20 + t.datetime "created_at", null: false
21 - t.datetime "updated_at", null: false
21 + t.datetime "updated_at", null: false
22 - t.boolean "frontpage", default: false
22 + t.boolean "frontpage", default: false
23 - t.boolean "contest_only", default: false
23 + t.boolean "contest_only", default: false
24 t.string "title", limit: 255
24 t.string "title", limit: 255
25 t.string "notes", limit: 255
25 t.string "notes", limit: 255
26 end
26 end
27
27
28 create_table "contests", force: :cascade do |t|
28 create_table "contests", force: :cascade do |t|
29 t.string "title", limit: 255
29 t.string "title", limit: 255
30 t.boolean "enabled"
30 t.boolean "enabled"
31 t.datetime "created_at", null: false
31 t.datetime "created_at", null: false
32 t.datetime "updated_at", null: false
32 t.datetime "updated_at", null: false
33 t.string "name", limit: 255
33 t.string "name", limit: 255
34 end
34 end
35
35
36 create_table "contests_problems", id: false, force: :cascade do |t|
36 create_table "contests_problems", id: false, force: :cascade do |t|
37 t.integer "contest_id", limit: 4
37 t.integer "contest_id", limit: 4
38 t.integer "problem_id", limit: 4
38 t.integer "problem_id", limit: 4
39 end
39 end
40
40
41 create_table "contests_users", id: false, force: :cascade do |t|
41 create_table "contests_users", id: false, force: :cascade do |t|
42 t.integer "contest_id", limit: 4
42 t.integer "contest_id", limit: 4
43 t.integer "user_id", limit: 4
43 t.integer "user_id", limit: 4
44 end
44 end
45
45
46 create_table "countries", force: :cascade do |t|
46 create_table "countries", force: :cascade do |t|
47 t.string "name", limit: 255
47 t.string "name", limit: 255
48 t.datetime "created_at", null: false
48 t.datetime "created_at", null: false
49 t.datetime "updated_at", null: false
49 t.datetime "updated_at", null: false
50 end
50 end
51
51
52 create_table "descriptions", force: :cascade do |t|
52 create_table "descriptions", force: :cascade do |t|
53 - t.text "body", limit: 16777215
53 + t.text "body", limit: 65535
54 t.boolean "markdowned"
54 t.boolean "markdowned"
55 - t.datetime "created_at", null: false
55 + t.datetime "created_at", null: false
56 - t.datetime "updated_at", null: false
56 + t.datetime "updated_at", null: false
57 end
57 end
58
58
59 create_table "grader_configurations", force: :cascade do |t|
59 create_table "grader_configurations", force: :cascade do |t|
60 t.string "key", limit: 255
60 t.string "key", limit: 255
61 t.string "value_type", limit: 255
61 t.string "value_type", limit: 255
62 t.string "value", limit: 255
62 t.string "value", limit: 255
63 - t.datetime "created_at", null: false
63 + t.datetime "created_at", null: false
64 - t.datetime "updated_at", null: false
64 + t.datetime "updated_at", null: false
65 - t.text "description", limit: 16777215
65 + t.text "description", limit: 65535
66 end
66 end
67
67
68 create_table "grader_processes", force: :cascade do |t|
68 create_table "grader_processes", force: :cascade do |t|
69 t.string "host", limit: 255
69 t.string "host", limit: 255
70 t.integer "pid", limit: 4
70 t.integer "pid", limit: 4
71 t.string "mode", limit: 255
71 t.string "mode", limit: 255
72 t.boolean "active"
72 t.boolean "active"
73 t.datetime "created_at", null: false
73 t.datetime "created_at", null: false
74 t.datetime "updated_at", null: false
74 t.datetime "updated_at", null: false
75 t.integer "task_id", limit: 4
75 t.integer "task_id", limit: 4
76 t.string "task_type", limit: 255
76 t.string "task_type", limit: 255
77 t.boolean "terminated"
77 t.boolean "terminated"
78 end
78 end
79
79
80 add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid", using: :btree
80 add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid", using: :btree
81
81
82 create_table "heart_beats", force: :cascade do |t|
82 create_table "heart_beats", force: :cascade do |t|
83 t.integer "user_id", limit: 4
83 t.integer "user_id", limit: 4
84 t.string "ip_address", limit: 255
84 t.string "ip_address", limit: 255
85 t.datetime "created_at", null: false
85 t.datetime "created_at", null: false
86 t.datetime "updated_at", null: false
86 t.datetime "updated_at", null: false
87 t.string "status", limit: 255
87 t.string "status", limit: 255
88 end
88 end
89
89
90 add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree
90 add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree
91
91
92 create_table "languages", force: :cascade do |t|
92 create_table "languages", force: :cascade do |t|
93 t.string "name", limit: 10
93 t.string "name", limit: 10
94 t.string "pretty_name", limit: 255
94 t.string "pretty_name", limit: 255
95 t.string "ext", limit: 10
95 t.string "ext", limit: 10
96 t.string "common_ext", limit: 255
96 t.string "common_ext", limit: 255
97 end
97 end
98
98
99 create_table "logins", force: :cascade do |t|
99 create_table "logins", force: :cascade do |t|
100 t.integer "user_id", limit: 4
100 t.integer "user_id", limit: 4
101 t.string "ip_address", limit: 255
101 t.string "ip_address", limit: 255
102 t.datetime "created_at", null: false
102 t.datetime "created_at", null: false
103 t.datetime "updated_at", null: false
103 t.datetime "updated_at", null: false
104 end
104 end
105
105
106 create_table "messages", force: :cascade do |t|
106 create_table "messages", force: :cascade do |t|
107 t.integer "sender_id", limit: 4
107 t.integer "sender_id", limit: 4
108 t.integer "receiver_id", limit: 4
108 t.integer "receiver_id", limit: 4
109 t.integer "replying_message_id", limit: 4
109 t.integer "replying_message_id", limit: 4
110 - t.text "body", limit: 16777215
110 + t.text "body", limit: 65535
111 t.boolean "replied"
111 t.boolean "replied"
112 - t.datetime "created_at", null: false
112 + t.datetime "created_at", null: false
113 - t.datetime "updated_at", null: false
113 + t.datetime "updated_at", null: false
114 end
114 end
115
115
116 create_table "problems", force: :cascade do |t|
116 create_table "problems", force: :cascade do |t|
117 t.string "name", limit: 30
117 t.string "name", limit: 30
118 t.string "full_name", limit: 255
118 t.string "full_name", limit: 255
119 t.integer "full_score", limit: 4
119 t.integer "full_score", limit: 4
120 t.date "date_added"
120 t.date "date_added"
121 t.boolean "available"
121 t.boolean "available"
122 t.string "url", limit: 255
122 t.string "url", limit: 255
123 t.integer "description_id", limit: 4
123 t.integer "description_id", limit: 4
124 t.boolean "test_allowed"
124 t.boolean "test_allowed"
125 t.boolean "output_only"
125 t.boolean "output_only"
126 t.string "description_filename", limit: 255
126 t.string "description_filename", limit: 255
127 t.boolean "view_testcase"
127 t.boolean "view_testcase"
128 end
128 end
129
129
130 create_table "rights", force: :cascade do |t|
130 create_table "rights", force: :cascade do |t|
131 t.string "name", limit: 255
131 t.string "name", limit: 255
132 t.string "controller", limit: 255
132 t.string "controller", limit: 255
133 t.string "action", limit: 255
133 t.string "action", limit: 255
134 end
134 end
135
135
136 create_table "rights_roles", id: false, force: :cascade do |t|
136 create_table "rights_roles", id: false, force: :cascade do |t|
137 t.integer "right_id", limit: 4
137 t.integer "right_id", limit: 4
138 t.integer "role_id", limit: 4
138 t.integer "role_id", limit: 4
139 end
139 end
140
140
141 add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree
141 add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree
142
142
143 create_table "roles", force: :cascade do |t|
143 create_table "roles", force: :cascade do |t|
144 t.string "name", limit: 255
144 t.string "name", limit: 255
145 end
145 end
146
146
147 create_table "roles_users", id: false, force: :cascade do |t|
147 create_table "roles_users", id: false, force: :cascade do |t|
148 t.integer "role_id", limit: 4
148 t.integer "role_id", limit: 4
149 t.integer "user_id", limit: 4
149 t.integer "user_id", limit: 4
150 end
150 end
151
151
152 add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree
152 add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree
153
153
154 create_table "sessions", force: :cascade do |t|
154 create_table "sessions", force: :cascade do |t|
155 t.string "session_id", limit: 255
155 t.string "session_id", limit: 255
156 - t.text "data", limit: 16777215
156 + t.text "data", limit: 65535
157 t.datetime "updated_at"
157 t.datetime "updated_at"
158 end
158 end
159
159
160 add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
160 add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
161 add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
161 add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
162
162
163 create_table "sites", force: :cascade do |t|
163 create_table "sites", force: :cascade do |t|
164 t.string "name", limit: 255
164 t.string "name", limit: 255
165 t.boolean "started"
165 t.boolean "started"
166 t.datetime "start_time"
166 t.datetime "start_time"
167 t.datetime "created_at", null: false
167 t.datetime "created_at", null: false
168 t.datetime "updated_at", null: false
168 t.datetime "updated_at", null: false
169 t.integer "country_id", limit: 4
169 t.integer "country_id", limit: 4
170 t.string "password", limit: 255
170 t.string "password", limit: 255
171 end
171 end
172
172
173 create_table "submission_view_logs", force: :cascade do |t|
173 create_table "submission_view_logs", force: :cascade do |t|
174 t.integer "user_id", limit: 4
174 t.integer "user_id", limit: 4
175 t.integer "submission_id", limit: 4
175 t.integer "submission_id", limit: 4
176 t.datetime "created_at", null: false
176 t.datetime "created_at", null: false
177 t.datetime "updated_at", null: false
177 t.datetime "updated_at", null: false
178 end
178 end
179
179
180 create_table "submissions", force: :cascade do |t|
180 create_table "submissions", force: :cascade do |t|
181 t.integer "user_id", limit: 4
181 t.integer "user_id", limit: 4
182 t.integer "problem_id", limit: 4
182 t.integer "problem_id", limit: 4
183 t.integer "language_id", limit: 4
183 t.integer "language_id", limit: 4
184 - t.text "source", limit: 16777215
184 + t.text "source", limit: 65535
185 t.binary "binary", limit: 65535
185 t.binary "binary", limit: 65535
186 t.datetime "submitted_at"
186 t.datetime "submitted_at"
187 t.datetime "compiled_at"
187 t.datetime "compiled_at"
188 - t.text "compiler_message", limit: 16777215
188 + t.text "compiler_message", limit: 65535
189 t.datetime "graded_at"
189 t.datetime "graded_at"
190 t.integer "points", limit: 4
190 t.integer "points", limit: 4
191 - t.text "grader_comment", limit: 16777215
191 + t.text "grader_comment", limit: 65535
192 t.integer "number", limit: 4
192 t.integer "number", limit: 4
193 t.string "source_filename", limit: 255
193 t.string "source_filename", limit: 255
194 t.float "max_runtime", limit: 24
194 t.float "max_runtime", limit: 24
195 t.integer "peak_memory", limit: 4
195 t.integer "peak_memory", limit: 4
196 t.integer "effective_code_length", limit: 4
196 t.integer "effective_code_length", limit: 4
197 t.string "ip_address", limit: 255
197 t.string "ip_address", limit: 255
198 end
198 end
199
199
200 add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree
200 add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree
201 add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree
201 add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree
202
202
203 create_table "tasks", force: :cascade do |t|
203 create_table "tasks", force: :cascade do |t|
204 t.integer "submission_id", limit: 4
204 t.integer "submission_id", limit: 4
205 t.datetime "created_at"
205 t.datetime "created_at"
206 t.integer "status", limit: 4
206 t.integer "status", limit: 4
207 t.datetime "updated_at"
207 t.datetime "updated_at"
208 end
208 end
209
209
210 + add_index "tasks", ["submission_id"], name: "index_tasks_on_submission_id", using: :btree
211 +
210 create_table "test_pairs", force: :cascade do |t|
212 create_table "test_pairs", force: :cascade do |t|
211 t.integer "problem_id", limit: 4
213 t.integer "problem_id", limit: 4
212 - t.text "input", limit: 4294967295
214 + t.text "input", limit: 16777215
213 - t.text "solution", limit: 4294967295
215 + t.text "solution", limit: 16777215
214 - t.datetime "created_at", null: false
216 + t.datetime "created_at", null: false
215 - t.datetime "updated_at", null: false
217 + t.datetime "updated_at", null: false
216 end
218 end
217
219
218 create_table "test_requests", force: :cascade do |t|
220 create_table "test_requests", force: :cascade do |t|
219 t.integer "user_id", limit: 4
221 t.integer "user_id", limit: 4
220 t.integer "problem_id", limit: 4
222 t.integer "problem_id", limit: 4
221 t.integer "submission_id", limit: 4
223 t.integer "submission_id", limit: 4
222 t.string "input_file_name", limit: 255
224 t.string "input_file_name", limit: 255
223 t.string "output_file_name", limit: 255
225 t.string "output_file_name", limit: 255
224 t.string "running_stat", limit: 255
226 t.string "running_stat", limit: 255
225 t.integer "status", limit: 4
227 t.integer "status", limit: 4
226 - t.datetime "updated_at", null: false
228 + t.datetime "updated_at", null: false
227 t.datetime "submitted_at"
229 t.datetime "submitted_at"
228 t.datetime "compiled_at"
230 t.datetime "compiled_at"
229 - t.text "compiler_message", limit: 16777215
231 + t.text "compiler_message", limit: 65535
230 t.datetime "graded_at"
232 t.datetime "graded_at"
231 t.string "grader_comment", limit: 255
233 t.string "grader_comment", limit: 255
232 - t.datetime "created_at", null: false
234 + t.datetime "created_at", null: false
233 t.float "running_time", limit: 24
235 t.float "running_time", limit: 24
234 t.string "exit_status", limit: 255
236 t.string "exit_status", limit: 255
235 t.integer "memory_usage", limit: 4
237 t.integer "memory_usage", limit: 4
236 end
238 end
237
239
238 add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree
240 add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree
239
241
240 create_table "testcases", force: :cascade do |t|
242 create_table "testcases", force: :cascade do |t|
241 t.integer "problem_id", limit: 4
243 t.integer "problem_id", limit: 4
242 t.integer "num", limit: 4
244 t.integer "num", limit: 4
243 t.integer "group", limit: 4
245 t.integer "group", limit: 4
244 t.integer "score", limit: 4
246 t.integer "score", limit: 4
245 t.text "input", limit: 4294967295
247 t.text "input", limit: 4294967295
246 t.text "sol", limit: 4294967295
248 t.text "sol", limit: 4294967295
247 - t.datetime "created_at", null: false
249 + t.datetime "created_at"
248 - t.datetime "updated_at", null: false
250 + t.datetime "updated_at"
249 end
251 end
250
252
251 add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id", using: :btree
253 add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id", using: :btree
252
254
253 create_table "user_contest_stats", force: :cascade do |t|
255 create_table "user_contest_stats", force: :cascade do |t|
254 t.integer "user_id", limit: 4
256 t.integer "user_id", limit: 4
255 t.datetime "started_at"
257 t.datetime "started_at"
256 t.datetime "created_at", null: false
258 t.datetime "created_at", null: false
257 t.datetime "updated_at", null: false
259 t.datetime "updated_at", null: false
258 t.boolean "forced_logout"
260 t.boolean "forced_logout"
259 end
261 end
260
262
261 create_table "users", force: :cascade do |t|
263 create_table "users", force: :cascade do |t|
262 t.string "login", limit: 50
264 t.string "login", limit: 50
263 t.string "full_name", limit: 255
265 t.string "full_name", limit: 255
264 t.string "hashed_password", limit: 255
266 t.string "hashed_password", limit: 255
265 t.string "salt", limit: 5
267 t.string "salt", limit: 5
266 t.string "alias", limit: 255
268 t.string "alias", limit: 255
267 t.string "email", limit: 255
269 t.string "email", limit: 255
268 t.integer "site_id", limit: 4
270 t.integer "site_id", limit: 4
269 t.integer "country_id", limit: 4
271 t.integer "country_id", limit: 4
270 t.boolean "activated", default: false
272 t.boolean "activated", default: false
271 t.datetime "created_at"
273 t.datetime "created_at"
272 t.datetime "updated_at"
274 t.datetime "updated_at"
273 - t.string "section", limit: 255
274 t.boolean "enabled", default: true
275 t.boolean "enabled", default: true
275 t.string "remark", limit: 255
276 t.string "remark", limit: 255
276 t.string "last_ip", limit: 255
277 t.string "last_ip", limit: 255
278 + t.string "section", limit: 255
277 end
279 end
278
280
279 add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree
281 add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree
280
282
281 end
283 end
You need to be logged in to leave comments. Login now