mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-25 00:08:25 -04:00
Remove duplicate setting of medians in migration
This commit is contained in:
1 parent
a5d43af899
commit
e4ab5114f7
1 file changed
-15
@@ -1,21 +1,6 @@
|
||||
class CreateMedianFunction < ActiveRecord::Migration
|
||||
def up
|
||||
ActiveMedian.create_function
|
||||
|
||||
say "Calculating lifespan of known finished plantings"
|
||||
Planting.where.not(planted_at: nil, finished_at: nil).each do |planting|
|
||||
planting.calculate_lifespan
|
||||
planting.save!
|
||||
if planting.crop.median_lifespan.present?
|
||||
say "#{planting.crop.name} median lifespan #{planting.crop.median_lifespan} days"
|
||||
end
|
||||
end
|
||||
|
||||
say 'Calculating median lifespan of crops'
|
||||
# Crop.all.each do |crop|
|
||||
# crop.update_medians
|
||||
# say "#{crop.name} median lifespan #{crop.median_lifespan} days" if crop.median_lifespan.present?
|
||||
# end
|
||||
end
|
||||
|
||||
def down
|
||||
|
||||
Reference in new issue
Block a user