Description:
problems sorted by update time
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

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
@@ -37,7 +37,9
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
@@ -37,6 +37,6
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
@@ -9,7 +9,7
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 => 20100209145331) do
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"
@@ -84,16 +84,17
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|
You need to be logged in to leave comments. Login now