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: 15 inserted, 3 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 |
@@ -34,13 +34,15 | |||
|
34 | 34 | test_num = 1 + rand(test_pair_count) |
|
35 | 35 | end |
|
36 | 36 | test_pairs.find_by_number test_num |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 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 | 43 | end |
|
42 | 44 | |
|
43 | 45 | # TODO: may try to optimize this using cache |
|
44 | 46 | def self.available_problem_count |
|
45 | 47 | return Problem.find_available_problems.length |
|
46 | 48 | end |
@@ -34,9 +34,9 | |||
|
34 | 34 | = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';" |
|
35 | 35 | Announcement.registerRefreshEventTimer(); |
|
36 | 36 | = render :partial => 'submission_timeouts' |
|
37 | 37 | CodejomTimeout.updateProblemMessages(); |
|
38 | 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 |
@@ -6,13 +6,13 | |||
|
6 | 6 | # to create the application database on another system, you should be using db:schema:load, not running |
|
7 | 7 | # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
8 | 8 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
9 | 9 | # |
|
10 | 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 | 14 | create_table "announcements", :force => true do |t| |
|
15 | 15 | t.string "author" |
|
16 | 16 | t.text "body" |
|
17 | 17 | t.boolean "published" |
|
18 | 18 | t.datetime "created_at" |
@@ -91,12 +91,13 | |||
|
91 | 91 | t.boolean "available" |
|
92 | 92 | t.string "url" |
|
93 | 93 | t.integer "description_id" |
|
94 | 94 | t.boolean "test_allowed" |
|
95 | 95 | t.boolean "output_only" |
|
96 | 96 | t.integer "level", :default => 0 |
|
97 | + t.datetime "updated_at" | |
|
97 | 98 | end |
|
98 | 99 | |
|
99 | 100 | create_table "rights", :force => true do |t| |
|
100 | 101 | t.string "name" |
|
101 | 102 | t.string "controller" |
|
102 | 103 | t.string "action" |
You need to be logged in to leave comments.
Login now