mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Prevent nil input to turn into 0
This commit is contained in:
@@ -28,8 +28,7 @@ namespace :ofn do
|
||||
task :truncate, [:months_to_keep] => :environment do |_task, args|
|
||||
warn_with_confirmation
|
||||
|
||||
months_to_keep = args.months_to_keep.to_i
|
||||
TruncateData.new(months_to_keep).call
|
||||
TruncateData.new(args.months_to_keep).call
|
||||
end
|
||||
|
||||
def warn_with_confirmation
|
||||
|
||||
@@ -8,7 +8,7 @@ class TruncateData
|
||||
end
|
||||
|
||||
def initialize(months_to_keep = nil)
|
||||
@date = (months_to_keep || 3).months.ago
|
||||
@date = (months_to_keep || 3).to_i.months.ago
|
||||
end
|
||||
|
||||
def call
|
||||
|
||||
Reference in New Issue
Block a user