Skip to content

Commit

Permalink
More shit
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Fonacier committed Jan 8, 2010
1 parent 501d104 commit be6686b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/controllers/questions_controller.rb
Expand Up @@ -7,9 +7,9 @@ def index
if params[:all]
@questions = Question.all_ready_to_go
elsif params[:debug]
@questions = Question.find(:all, :order => "created_at DESC")
@questions = Question.find(:all)
else
@questions = Question.ready_to_go
Question.find(:all, :conditions => ["created_at > ? AND created_at < ? AND disable = ?", 2.minutes.ago, 1.minute.ago, false])
end

respond_to do |format|
Expand Down
2 changes: 1 addition & 1 deletion app/models/question.rb
Expand Up @@ -3,6 +3,6 @@ class Question < ActiveRecord::Base
validates_length_of :question, :minimum => 10

# Find the undisabled questions within the last 5 minutes sorted by created_at
named_scope :ready_to_go, :conditions => ["disable = ? AND created_at > ? AND created_at < ?", false, 1.minute.ago, 2.minutes.ago], :limit => 50, :order => "created_at DESC"
named_scope :ready_to_go, :conditions => ["disable = ? AND created_at > ? AND created_at < ?", false, 1.minute.ago, 5.minutes.ago], :limit => 50, :order => "created_at DESC"
named_scope :all_ready_to_go, :conditions => ["disable = ? AND created_at > ?", false, 1.minute.ago], :order => "created_at DESC"
end

0 comments on commit be6686b

Please sign in to comment.