Skip to content

Commit

Permalink
Do it well this time.
Browse files Browse the repository at this point in the history
  • Loading branch information
deathowl committed Jan 8, 2014
1 parent 472a6d4 commit 910e64f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/interactors/outdated_prolem_clearer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def nb_problem_outdated
end

def criteria
@criteria = (Time.new - Problem.last_notice_at) / 3600 / 24 > 7
@criteria = Problem.outdated
end

def repair_database
Expand Down
2 changes: 2 additions & 0 deletions app/models/problem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class Problem
scope :unresolved, where(:resolved => false)
scope :ordered, order_by(:last_notice_at.desc)
scope :for_apps, lambda {|apps| where(:app_id.in => apps.all.map(&:id))}
scope :outdated, where(:last_notice_at.lt => 1.week.ago)


validates_presence_of :last_notice_at, :first_notice_at

Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/errbit/database.rake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace :errbit do
desc "Delete old errors from the database. (Useful for limited heroku databases)"
task :clear_outdated => :environment do
require 'outdated_problem_clearer'
puts "=== Cleared #{OutdatedProblemClearer.new.execute} resolved errors from the database."
puts "=== Cleared #{OutdatedProblemClearer.new.execute} outdated errors from the database."
end

desc "Regenerate fingerprints"
Expand Down

0 comments on commit 910e64f

Please sign in to comment.