Description:
problems sorted by update time
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r258:1821e2e3aeb0 - - 4 files changed: 25 inserted, 13 deleted
@@ -0,0 +1,9 | |||||
|
|
1 | + class AddTimestampToProblems < ActiveRecord::Migration | ||
|
|
2 | + def self.up | ||
|
|
3 | + add_column :problems, :updated_at, :timestamp | ||
|
|
4 | + end | ||
|
|
5 | + | ||
|
|
6 | + def self.down | ||
|
|
7 | + remove_column :problems, :updated_at | ||
|
|
8 | + end | ||
|
|
9 | + end |
@@ -1,132 +1,134 | |||||
|
1 | class Problem < ActiveRecord::Base |
|
1 | class Problem < ActiveRecord::Base |
|
2 |
|
2 | ||
|
3 | belongs_to :description |
|
3 | belongs_to :description |
|
4 | has_many :test_pairs, :dependent => :delete_all |
|
4 | has_many :test_pairs, :dependent => :delete_all |
|
5 |
|
5 | ||
|
6 | named_scope :level, lambda { |level| |
|
6 | named_scope :level, lambda { |level| |
|
7 | { :conditions => { :level => level }} |
|
7 | { :conditions => { :level => level }} |
|
8 | } |
|
8 | } |
|
9 |
|
9 | ||
|
10 | named_scope :unavailable, { :conditions => { :available => false }} |
|
10 | named_scope :unavailable, { :conditions => { :available => false }} |
|
11 |
|
11 | ||
|
12 |
|
12 | ||
|
13 | validates_presence_of :name |
|
13 | validates_presence_of :name |
|
14 | validates_format_of :name, :with => /^\w+$/ |
|
14 | validates_format_of :name, :with => /^\w+$/ |
|
15 | validates_presence_of :full_name |
|
15 | validates_presence_of :full_name |
|
16 |
|
16 | ||
|
17 | DEFAULT_TIME_LIMIT = 1 |
|
17 | DEFAULT_TIME_LIMIT = 1 |
|
18 | DEFAULT_MEMORY_LIMIT = 32 |
|
18 | DEFAULT_MEMORY_LIMIT = 32 |
|
19 |
|
19 | ||
|
20 | def test_pair_count |
|
20 | def test_pair_count |
|
21 | @test_pair_count ||= test_pairs.size |
|
21 | @test_pair_count ||= test_pairs.size |
|
22 | end |
|
22 | end |
|
23 |
|
23 | ||
|
24 | def uses_random_test_pair? |
|
24 | def uses_random_test_pair? |
|
25 | test_pair_count != 0 |
|
25 | test_pair_count != 0 |
|
26 | end |
|
26 | end |
|
27 |
|
27 | ||
|
28 | def random_test_pair(forbidden_numbers=nil) |
|
28 | def random_test_pair(forbidden_numbers=nil) |
|
29 | if forbidden_numbers.length < test_pair_count |
|
29 | if forbidden_numbers.length < test_pair_count |
|
30 | begin |
|
30 | begin |
|
31 | test_num = 1 + rand(test_pair_count) |
|
31 | test_num = 1 + rand(test_pair_count) |
|
32 | end while forbidden_numbers!=nil and forbidden_numbers.include? test_num |
|
32 | end while forbidden_numbers!=nil and forbidden_numbers.include? test_num |
|
33 | else |
|
33 | else |
|
34 | test_num = 1 + rand(test_pair_count) |
|
34 | test_num = 1 + rand(test_pair_count) |
|
35 | end |
|
35 | end |
|
36 | test_pairs.find_by_number test_num |
|
36 | test_pairs.find_by_number test_num |
|
37 | end |
|
37 | end |
|
38 |
|
38 | ||
|
39 | def self.find_available_problems |
|
39 | def self.find_available_problems |
|
40 | - find(:all, :conditions => {:available => true}, :order => "date_added DESC") |
|
40 | + find(:all, |
|
|
41 | + :conditions => {:available => true}, | ||
|
|
42 | + :order => "updated_at DESC") | ||
|
41 | end |
|
43 | end |
|
42 |
|
44 | ||
|
43 | # TODO: may try to optimize this using cache |
|
45 | # TODO: may try to optimize this using cache |
|
44 | def self.available_problem_count |
|
46 | def self.available_problem_count |
|
45 | return Problem.find_available_problems.length |
|
47 | return Problem.find_available_problems.length |
|
46 | end |
|
48 | end |
|
47 |
|
49 | ||
|
48 | def self.create_from_import_form_params(params, old_problem=nil) |
|
50 | def self.create_from_import_form_params(params, old_problem=nil) |
|
49 | problem = old_problem || Problem.new |
|
51 | problem = old_problem || Problem.new |
|
50 | import_params = Problem.extract_params_and_check(params, problem) |
|
52 | import_params = Problem.extract_params_and_check(params, problem) |
|
51 |
|
53 | ||
|
52 | if not problem.valid? |
|
54 | if not problem.valid? |
|
53 | return problem, 'Error importing' |
|
55 | return problem, 'Error importing' |
|
54 | end |
|
56 | end |
|
55 |
|
57 | ||
|
56 | problem.full_score = 100 |
|
58 | problem.full_score = 100 |
|
57 | problem.date_added = Time.new |
|
59 | problem.date_added = Time.new |
|
58 | problem.test_allowed = true |
|
60 | problem.test_allowed = true |
|
59 | problem.output_only = false |
|
61 | problem.output_only = false |
|
60 | problem.available = false |
|
62 | problem.available = false |
|
61 |
|
63 | ||
|
62 | if not problem.save |
|
64 | if not problem.save |
|
63 | return problem, 'Error importing' |
|
65 | return problem, 'Error importing' |
|
64 | end |
|
66 | end |
|
65 |
|
67 | ||
|
66 | import_to_db = params.has_key? :import_to_db |
|
68 | import_to_db = params.has_key? :import_to_db |
|
67 |
|
69 | ||
|
68 | importer = TestdataImporter.new(problem) |
|
70 | importer = TestdataImporter.new(problem) |
|
69 |
|
71 | ||
|
70 | if not importer.import_from_file(import_params[:file], |
|
72 | if not importer.import_from_file(import_params[:file], |
|
71 | import_params[:time_limit], |
|
73 | import_params[:time_limit], |
|
72 | import_params[:memory_limit], |
|
74 | import_params[:memory_limit], |
|
73 | import_to_db) |
|
75 | import_to_db) |
|
74 | problem.errors.add_to_base('Import error.') |
|
76 | problem.errors.add_to_base('Import error.') |
|
75 | end |
|
77 | end |
|
76 |
|
78 | ||
|
77 | return problem, importer.log_msg |
|
79 | return problem, importer.log_msg |
|
78 | end |
|
80 | end |
|
79 |
|
81 | ||
|
80 | protected |
|
82 | protected |
|
81 |
|
83 | ||
|
82 | def self.to_i_or_default(st, default) |
|
84 | def self.to_i_or_default(st, default) |
|
83 | if st!='' |
|
85 | if st!='' |
|
84 | st.to_i |
|
86 | st.to_i |
|
85 | else |
|
87 | else |
|
86 | default |
|
88 | default |
|
87 | end |
|
89 | end |
|
88 | end |
|
90 | end |
|
89 |
|
91 | ||
|
90 | def self.extract_params_and_check(params, problem) |
|
92 | def self.extract_params_and_check(params, problem) |
|
91 | time_limit = Problem.to_i_or_default(params[:time_limit], |
|
93 | time_limit = Problem.to_i_or_default(params[:time_limit], |
|
92 | DEFAULT_TIME_LIMIT) |
|
94 | DEFAULT_TIME_LIMIT) |
|
93 | memory_limit = Problem.to_i_or_default(params[:memory_limit], |
|
95 | memory_limit = Problem.to_i_or_default(params[:memory_limit], |
|
94 | DEFAULT_MEMORY_LIMIT) |
|
96 | DEFAULT_MEMORY_LIMIT) |
|
95 |
|
97 | ||
|
96 | if time_limit==0 and time_limit_s!='0' |
|
98 | if time_limit==0 and time_limit_s!='0' |
|
97 | problem.errors.add_to_base('Time limit format errors.') |
|
99 | problem.errors.add_to_base('Time limit format errors.') |
|
98 | elsif time_limit<=0 or time_limit >60 |
|
100 | elsif time_limit<=0 or time_limit >60 |
|
99 | problem.errors.add_to_base('Time limit out of range.') |
|
101 | problem.errors.add_to_base('Time limit out of range.') |
|
100 | end |
|
102 | end |
|
101 |
|
103 | ||
|
102 | if memory_limit==0 and memory_limit_s!='0' |
|
104 | if memory_limit==0 and memory_limit_s!='0' |
|
103 | problem.errors.add_to_base('Memory limit format errors.') |
|
105 | problem.errors.add_to_base('Memory limit format errors.') |
|
104 | elsif memory_limit<=0 or memory_limit >512 |
|
106 | elsif memory_limit<=0 or memory_limit >512 |
|
105 | problem.errors.add_to_base('Memory limit out of range.') |
|
107 | problem.errors.add_to_base('Memory limit out of range.') |
|
106 | end |
|
108 | end |
|
107 |
|
109 | ||
|
108 | if params[:file]==nil or params[:file]=='' |
|
110 | if params[:file]==nil or params[:file]=='' |
|
109 | problem.errors.add_to_base('No testdata file.') |
|
111 | problem.errors.add_to_base('No testdata file.') |
|
110 | end |
|
112 | end |
|
111 |
|
113 | ||
|
112 | file = params[:file] |
|
114 | file = params[:file] |
|
113 |
|
115 | ||
|
114 | if problem.errors.length!=0 |
|
116 | if problem.errors.length!=0 |
|
115 | return problem |
|
117 | return problem |
|
116 | end |
|
118 | end |
|
117 |
|
119 | ||
|
118 | problem.name = params[:name] |
|
120 | problem.name = params[:name] |
|
119 | if params[:full_name]!='' |
|
121 | if params[:full_name]!='' |
|
120 | problem.full_name = params[:full_name] |
|
122 | problem.full_name = params[:full_name] |
|
121 | else |
|
123 | else |
|
122 | problem.full_name = params[:name] |
|
124 | problem.full_name = params[:name] |
|
123 | end |
|
125 | end |
|
124 |
|
126 | ||
|
125 | return { |
|
127 | return { |
|
126 | :time_limit => time_limit, |
|
128 | :time_limit => time_limit, |
|
127 | :memory_limit => memory_limit, |
|
129 | :memory_limit => memory_limit, |
|
128 | :file => file |
|
130 | :file => file |
|
129 | } |
|
131 | } |
|
130 | end |
|
132 | end |
|
131 |
|
133 | ||
|
132 | end |
|
134 | end |
@@ -1,42 +1,42 | |||||
|
1 | - content_for :head do |
|
1 | - content_for :head do |
|
2 | = javascript_include_tag :defaults |
|
2 | = javascript_include_tag :defaults |
|
3 | = javascript_include_tag 'announcement_refresh.js' |
|
3 | = javascript_include_tag 'announcement_refresh.js' |
|
4 | = javascript_include_tag 'codejom_timeout.js' |
|
4 | = javascript_include_tag 'codejom_timeout.js' |
|
5 |
|
5 | ||
|
6 | = user_title_bar(@user) |
|
6 | = user_title_bar(@user) |
|
7 |
|
7 | ||
|
8 | .announcementbox{:style => (@announcements.length==0 ? "display:none" : "")} |
|
8 | .announcementbox{:style => (@announcements.length==0 ? "display:none" : "")} |
|
9 | %span{:class => 'title'} |
|
9 | %span{:class => 'title'} |
|
10 | Announcements |
|
10 | Announcements |
|
11 | #announcementbox-body |
|
11 | #announcementbox-body |
|
12 | = render :partial => 'announcement', :collection => @announcements |
|
12 | = render :partial => 'announcement', :collection => @announcements |
|
13 |
|
13 | ||
|
14 | %hr/ |
|
14 | %hr/ |
|
15 |
|
15 | ||
|
16 | - if (Configuration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
16 | - if (Configuration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
17 | %p=t 'main.start_soon' |
|
17 | %p=t 'main.start_soon' |
|
18 |
|
18 | ||
|
19 | - if Configuration.show_tasks_to?(@user) |
|
19 | - if Configuration.show_tasks_to?(@user) |
|
20 | .problem-list{:id => 'problem-list'} |
|
20 | .problem-list{:id => 'problem-list'} |
|
21 | = render :partial => 'problem_title', :collection => @problems, :as => :problem |
|
21 | = render :partial => 'problem_title', :collection => @problems, :as => :problem |
|
22 | .problem-content |
|
22 | .problem-content |
|
23 | %span{:id => "problem-panel-filler", :style => (@current_problem_id!=nil) ? "display:none" : ""} |
|
23 | %span{:id => "problem-panel-filler", :style => (@current_problem_id!=nil) ? "display:none" : ""} |
|
24 | %h2 |
|
24 | %h2 |
|
25 | Welcome to Code Jom |
|
25 | Welcome to Code Jom |
|
26 | %br/ |
|
26 | %br/ |
|
27 | Choose problems from the list on the right. |
|
27 | Choose problems from the list on the right. |
|
28 | = render :partial => 'problem', :collection => @problems |
|
28 | = render :partial => 'problem', :collection => @problems |
|
29 |
|
29 | ||
|
30 | %br{:clear=>'both'}/ |
|
30 | %br{:clear=>'both'}/ |
|
31 | %hr/ |
|
31 | %hr/ |
|
32 |
|
32 | ||
|
33 | %script{:type => 'text/javascript'} |
|
33 | %script{:type => 'text/javascript'} |
|
34 | = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';" |
|
34 | = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';" |
|
35 | Announcement.registerRefreshEventTimer(); |
|
35 | Announcement.registerRefreshEventTimer(); |
|
36 | = render :partial => 'submission_timeouts' |
|
36 | = render :partial => 'submission_timeouts' |
|
37 | CodejomTimeout.updateProblemMessages(); |
|
37 | CodejomTimeout.updateProblemMessages(); |
|
38 | CodejomTimeout.registerRefreshEvent(); |
|
38 | CodejomTimeout.registerRefreshEvent(); |
|
39 |
|
39 | ||
|
40 | - = periodically_call_remote(:url => { :action => 'problems' }, :update => 'problem-list') |
|
40 | + = periodically_call_remote(:url => { :action => 'problems' }, :update => 'problem-list', :frequency => '3') |
|
41 |
|
41 | ||
|
42 |
|
42 |
@@ -1,192 +1,193 | |||||
|
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 Active Record to incrementally modify your database, and |
|
2 | # please use the migrations feature of Active Record 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 => 201002 |
|
12 | + ActiveRecord::Schema.define(:version => 20100210012432) 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 | t.boolean "frontpage", :default => false |
|
20 | t.boolean "frontpage", :default => false |
|
21 | t.boolean "contest_only", :default => false |
|
21 | t.boolean "contest_only", :default => false |
|
22 | t.string "title" |
|
22 | t.string "title" |
|
23 | end |
|
23 | end |
|
24 |
|
24 | ||
|
25 | create_table "codejom_statuses", :force => true do |t| |
|
25 | create_table "codejom_statuses", :force => true do |t| |
|
26 | t.integer "user_id" |
|
26 | t.integer "user_id" |
|
27 | t.boolean "alive" |
|
27 | t.boolean "alive" |
|
28 | t.integer "num_problems_passed" |
|
28 | t.integer "num_problems_passed" |
|
29 | t.datetime "created_at" |
|
29 | t.datetime "created_at" |
|
30 | t.datetime "updated_at" |
|
30 | t.datetime "updated_at" |
|
31 | end |
|
31 | end |
|
32 |
|
32 | ||
|
33 | create_table "configurations", :force => true do |t| |
|
33 | create_table "configurations", :force => true do |t| |
|
34 | t.string "key" |
|
34 | t.string "key" |
|
35 | t.string "value_type" |
|
35 | t.string "value_type" |
|
36 | t.string "value" |
|
36 | t.string "value" |
|
37 | t.datetime "created_at" |
|
37 | t.datetime "created_at" |
|
38 | t.datetime "updated_at" |
|
38 | t.datetime "updated_at" |
|
39 | t.text "description" |
|
39 | t.text "description" |
|
40 | end |
|
40 | end |
|
41 |
|
41 | ||
|
42 | create_table "countries", :force => true do |t| |
|
42 | create_table "countries", :force => true do |t| |
|
43 | t.string "name" |
|
43 | t.string "name" |
|
44 | t.datetime "created_at" |
|
44 | t.datetime "created_at" |
|
45 | t.datetime "updated_at" |
|
45 | t.datetime "updated_at" |
|
46 | end |
|
46 | end |
|
47 |
|
47 | ||
|
48 | create_table "descriptions", :force => true do |t| |
|
48 | create_table "descriptions", :force => true do |t| |
|
49 | t.text "body" |
|
49 | t.text "body" |
|
50 | t.boolean "markdowned" |
|
50 | t.boolean "markdowned" |
|
51 | t.datetime "created_at" |
|
51 | t.datetime "created_at" |
|
52 | t.datetime "updated_at" |
|
52 | t.datetime "updated_at" |
|
53 | end |
|
53 | end |
|
54 |
|
54 | ||
|
55 | create_table "grader_processes", :force => true do |t| |
|
55 | create_table "grader_processes", :force => true do |t| |
|
56 | t.string "host", :limit => 20 |
|
56 | t.string "host", :limit => 20 |
|
57 | t.integer "pid" |
|
57 | t.integer "pid" |
|
58 | t.string "mode" |
|
58 | t.string "mode" |
|
59 | t.boolean "active" |
|
59 | t.boolean "active" |
|
60 | t.datetime "created_at" |
|
60 | t.datetime "created_at" |
|
61 | t.datetime "updated_at" |
|
61 | t.datetime "updated_at" |
|
62 | t.integer "task_id" |
|
62 | t.integer "task_id" |
|
63 | t.string "task_type" |
|
63 | t.string "task_type" |
|
64 | t.boolean "terminated" |
|
64 | t.boolean "terminated" |
|
65 | end |
|
65 | end |
|
66 |
|
66 | ||
|
67 | add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid" |
|
67 | add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid" |
|
68 |
|
68 | ||
|
69 | create_table "languages", :force => true do |t| |
|
69 | create_table "languages", :force => true do |t| |
|
70 | t.string "name", :limit => 10 |
|
70 | t.string "name", :limit => 10 |
|
71 | t.string "pretty_name" |
|
71 | t.string "pretty_name" |
|
72 | t.string "ext", :limit => 10 |
|
72 | t.string "ext", :limit => 10 |
|
73 | t.string "common_ext" |
|
73 | t.string "common_ext" |
|
74 | end |
|
74 | end |
|
75 |
|
75 | ||
|
76 | create_table "messages", :force => true do |t| |
|
76 | create_table "messages", :force => true do |t| |
|
77 | t.integer "sender_id" |
|
77 | t.integer "sender_id" |
|
78 | t.integer "receiver_id" |
|
78 | t.integer "receiver_id" |
|
79 | t.integer "replying_message_id" |
|
79 | t.integer "replying_message_id" |
|
80 | t.text "body" |
|
80 | t.text "body" |
|
81 | t.boolean "replied" |
|
81 | t.boolean "replied" |
|
82 | t.datetime "created_at" |
|
82 | t.datetime "created_at" |
|
83 | t.datetime "updated_at" |
|
83 | t.datetime "updated_at" |
|
84 | end |
|
84 | end |
|
85 |
|
85 | ||
|
86 | create_table "problems", :force => true do |t| |
|
86 | create_table "problems", :force => true do |t| |
|
87 | - t.string "name", :limit => 30 |
|
87 | + t.string "name", :limit => 30 |
|
88 | - t.string "full_name" |
|
88 | + t.string "full_name" |
|
89 | - t.integer "full_score" |
|
89 | + t.integer "full_score" |
|
90 | - t.date "date_added" |
|
90 | + t.date "date_added" |
|
91 | - t.boolean "available" |
|
91 | + t.boolean "available" |
|
92 | - t.string "url" |
|
92 | + t.string "url" |
|
93 | - t.integer "description_id" |
|
93 | + t.integer "description_id" |
|
94 | - t.boolean "test_allowed" |
|
94 | + t.boolean "test_allowed" |
|
95 | - t.boolean "output_only" |
|
95 | + t.boolean "output_only" |
|
96 | - t.integer "level", :default => 0 |
|
96 | + t.integer "level", :default => 0 |
|
|
97 | + t.datetime "updated_at" | ||
|
97 | end |
|
98 | end |
|
98 |
|
99 | ||
|
99 | create_table "rights", :force => true do |t| |
|
100 | create_table "rights", :force => true do |t| |
|
100 | t.string "name" |
|
101 | t.string "name" |
|
101 | t.string "controller" |
|
102 | t.string "controller" |
|
102 | t.string "action" |
|
103 | t.string "action" |
|
103 | end |
|
104 | end |
|
104 |
|
105 | ||
|
105 | create_table "rights_roles", :id => false, :force => true do |t| |
|
106 | create_table "rights_roles", :id => false, :force => true do |t| |
|
106 | t.integer "right_id" |
|
107 | t.integer "right_id" |
|
107 | t.integer "role_id" |
|
108 | t.integer "role_id" |
|
108 | end |
|
109 | end |
|
109 |
|
110 | ||
|
110 | add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id" |
|
111 | add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id" |
|
111 |
|
112 | ||
|
112 | create_table "roles", :force => true do |t| |
|
113 | create_table "roles", :force => true do |t| |
|
113 | t.string "name" |
|
114 | t.string "name" |
|
114 | end |
|
115 | end |
|
115 |
|
116 | ||
|
116 | create_table "roles_users", :id => false, :force => true do |t| |
|
117 | create_table "roles_users", :id => false, :force => true do |t| |
|
117 | t.integer "role_id" |
|
118 | t.integer "role_id" |
|
118 | t.integer "user_id" |
|
119 | t.integer "user_id" |
|
119 | end |
|
120 | end |
|
120 |
|
121 | ||
|
121 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
122 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
122 |
|
123 | ||
|
123 | create_table "sessions", :force => true do |t| |
|
124 | create_table "sessions", :force => true do |t| |
|
124 | t.string "session_id" |
|
125 | t.string "session_id" |
|
125 | t.text "data" |
|
126 | t.text "data" |
|
126 | t.datetime "updated_at" |
|
127 | t.datetime "updated_at" |
|
127 | end |
|
128 | end |
|
128 |
|
129 | ||
|
129 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
130 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
130 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
131 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
131 |
|
132 | ||
|
132 | create_table "sites", :force => true do |t| |
|
133 | create_table "sites", :force => true do |t| |
|
133 | t.string "name" |
|
134 | t.string "name" |
|
134 | t.boolean "started" |
|
135 | t.boolean "started" |
|
135 | t.datetime "start_time" |
|
136 | t.datetime "start_time" |
|
136 | t.datetime "created_at" |
|
137 | t.datetime "created_at" |
|
137 | t.datetime "updated_at" |
|
138 | t.datetime "updated_at" |
|
138 | t.integer "country_id" |
|
139 | t.integer "country_id" |
|
139 | t.string "password" |
|
140 | t.string "password" |
|
140 | end |
|
141 | end |
|
141 |
|
142 | ||
|
142 | create_table "submission_statuses", :force => true do |t| |
|
143 | create_table "submission_statuses", :force => true do |t| |
|
143 | t.integer "user_id" |
|
144 | t.integer "user_id" |
|
144 | t.integer "problem_id" |
|
145 | t.integer "problem_id" |
|
145 | t.boolean "passed" |
|
146 | t.boolean "passed" |
|
146 | t.integer "submission_count" |
|
147 | t.integer "submission_count" |
|
147 | t.datetime "created_at" |
|
148 | t.datetime "created_at" |
|
148 | t.datetime "updated_at" |
|
149 | t.datetime "updated_at" |
|
149 | end |
|
150 | end |
|
150 |
|
151 | ||
|
151 | create_table "submissions", :force => true do |t| |
|
152 | create_table "submissions", :force => true do |t| |
|
152 | t.integer "user_id" |
|
153 | t.integer "user_id" |
|
153 | t.integer "problem_id" |
|
154 | t.integer "problem_id" |
|
154 | t.integer "language_id" |
|
155 | t.integer "language_id" |
|
155 | t.text "source" |
|
156 | t.text "source" |
|
156 | t.binary "binary" |
|
157 | t.binary "binary" |
|
157 | t.datetime "submitted_at" |
|
158 | t.datetime "submitted_at" |
|
158 | t.datetime "compiled_at" |
|
159 | t.datetime "compiled_at" |
|
159 | t.text "compiler_message" |
|
160 | t.text "compiler_message" |
|
160 | t.datetime "graded_at" |
|
161 | t.datetime "graded_at" |
|
161 | t.integer "points" |
|
162 | t.integer "points" |
|
162 | t.text "grader_comment" |
|
163 | t.text "grader_comment" |
|
163 | t.integer "number" |
|
164 | t.integer "number" |
|
164 | t.string "source_filename" |
|
165 | t.string "source_filename" |
|
165 | end |
|
166 | end |
|
166 |
|
167 | ||
|
167 | add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true |
|
168 | add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true |
|
168 | add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id" |
|
169 | add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id" |
|
169 |
|
170 | ||
|
170 | create_table "tasks", :force => true do |t| |
|
171 | create_table "tasks", :force => true do |t| |
|
171 | t.integer "submission_id" |
|
172 | t.integer "submission_id" |
|
172 | t.datetime "created_at" |
|
173 | t.datetime "created_at" |
|
173 | t.integer "status" |
|
174 | t.integer "status" |
|
174 | t.datetime "updated_at" |
|
175 | t.datetime "updated_at" |
|
175 | end |
|
176 | end |
|
176 |
|
177 | ||
|
177 | create_table "test_pair_assignments", :force => true do |t| |
|
178 | create_table "test_pair_assignments", :force => true do |t| |
|
178 | t.integer "user_id" |
|
179 | t.integer "user_id" |
|
179 | t.integer "problem_id" |
|
180 | t.integer "problem_id" |
|
180 | t.integer "test_pair_id" |
|
181 | t.integer "test_pair_id" |
|
181 | t.integer "test_pair_number" |
|
182 | t.integer "test_pair_number" |
|
182 | t.integer "request_number" |
|
183 | t.integer "request_number" |
|
183 | t.datetime "created_at" |
|
184 | t.datetime "created_at" |
|
184 | t.datetime "updated_at" |
|
185 | t.datetime "updated_at" |
|
185 | t.boolean "submitted" |
|
186 | t.boolean "submitted" |
|
186 | end |
|
187 | end |
|
187 |
|
188 | ||
|
188 | create_table "test_pairs", :force => true do |t| |
|
189 | create_table "test_pairs", :force => true do |t| |
|
189 | t.integer "problem_id" |
|
190 | t.integer "problem_id" |
|
190 | t.text "input", :limit => 16777215 |
|
191 | t.text "input", :limit => 16777215 |
|
191 | t.text "solution", :limit => 16777215 |
|
192 | t.text "solution", :limit => 16777215 |
|
192 | t.datetime "created_at" |
|
193 | t.datetime "created_at" |
You need to be logged in to leave comments.
Login now