Revision c820bdbb
Added by Ohad Levy about 14 years ago
- ID c820bdbb9b6795a748a83896d3335dab6fdc9398
app/models/report.rb | ||
---|---|---|
def self.expire(conditions = {})
|
||
timerange = conditions[:timerange] || 1.week
|
||
status = conditions[:status]
|
||
cond = "reported_at < \'#{(Time.now.utc - timerange).to_formatted_s(:db)}\'"
|
||
cond = "created_at < \'#{(Time.now.utc - timerange).to_formatted_s(:db)}\'"
|
||
cond += " and status = #{status}" unless status.nil?
|
||
# delete the reports
|
||
count = Report.delete_all(cond)
|
Also available in: Unified diff
fixes #160 - Last Report Date is client date, not date report was received