diff options
author | Marius Peter <dev@marius-peter.com> | 2025-09-04 20:55:03 +0200 |
---|---|---|
committer | Marius Peter <dev@marius-peter.com> | 2025-09-04 20:55:03 +0200 |
commit | 8ba568ae0ebe715b5da453681eb141886f1977a8 (patch) | |
tree | 3bf3a3d5b41286d0a6da8895857314393bae1db2 /db/seeds/6_fertilizer_products.rb | |
parent | 8f8cea2a0408918629dc8bab03495530861a71f3 (diff) |
Start small, address critical customer needs, /then/ scale.
Diffstat (limited to 'db/seeds/6_fertilizer_products.rb')
-rw-r--r-- | db/seeds/6_fertilizer_products.rb | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/db/seeds/6_fertilizer_products.rb b/db/seeds/6_fertilizer_products.rb deleted file mode 100644 index 6769bde..0000000 --- a/db/seeds/6_fertilizer_products.rb +++ /dev/null @@ -1,143 +0,0 @@ -FERTILIZER_RECIPES = [ - { - name: "Multi K Reci", - purity: 99.0, - composition: [ - { component: { - name: "Potassium nitrate", - formula: "KNO3", - nno3: 13.0, - k: 46.0 }, - percent_w: 100.0 } - ] - }, - { - name: "Fixa Mn", - purity: 98.0, - composition: [ - { component: { - name: "Manganese sulfate", - formula: "MnSO4·H2O", - mn: 32.0, - s: 18.0 }, - percent_w: 100.0 } - ] - }, - { - name: "Multi-Cal Haïfa", - purity: 99.0, - composition: [ - { component: { - name: "Calcium nitrate", - formula: "Ca(NO3)2·4H2O", - nno3: 15.5, - ca: 19.0 }, - percent_w: 100.0 } - ] - }, - { - name: "DAP 18/46/00", - purity: 100.0, - composition: [ - { component: { - name: "Diammonium phosphate", - formula: "(NH4)2HPO4", - nnh4: 18.0, - p: 20.0 }, - percent_w: 100.0 } - ] - }, - { - name: "Patenkali", - purity: 100.0, - composition: [ - { component: { - name: "Potassium sulfate", - formula: "K2SO4", - k: 50.0, - s: 18.0 - }, percent_w: 100.0 } - ] - }, - { - name: "Eso Top", - purity: 100.0, - composition: [ - { component: { - name: "Magnesium sulfate", - formula: "MgSO4·7H2O", - mg: 9.8, - s: 13.0 }, - percent_w: 100.0 } - ] - }, - { - name: "Ammonitrate 27", - purity: 100.0, - composition: [ - { component: { - name: "Ammonium nitrate", - formula: "NH4NO3", - nno3: 13.5, - nnh4: 13.5 }, - percent_w: 100.0 } - ] - }, - { - name: "Fer chélaté", - purity: 100.0, - composition: [ - { component: { - name: "Iron chelate (EDDHA)", - formula: "Fe-EDDHA", - fe: 6.0 }, - percent_w: 100.0 } - ] - }, - { - name: "Carbonate de calcium", - purity: 100.0, - composition: [ - { component: { - name: "Calcium carbonate", - formula: "CaCO3", - ca: 40.0 }, - percent_w: 100.0 } - ] - }, - { - name: "Héliocuivre", - purity: 100.0, - composition: [ - { component: { - name: "Copper chelate (EDTA)", - formula: "Cu-EDTA", - cu: 14.0 }, - percent_w: 100.0 } - ] - } -] - -FERTILIZER_RECIPES.each do |recipe| - product = FertilizerProduct.find_or_create_by!(name: recipe[:name]) do |fp| - fp.purity = recipe[:purity] - end - - recipe[:composition].each do |c| - comp_attrs = c[:component] - component = FertilizerComponent.find_or_create_by!(name: comp_attrs[:name]) do |fc| - fc.formula = comp_attrs[:formula] - end - # update nutrient fields if missing - component.update!(comp_attrs.except(:name, :formula)) - - FertilizerComposition.find_or_create_by!( - fertilizer_product: product, - fertilizer_component: component - ) do |fc| - fc.percent_w = c[:percent_w] - end - end -end - -puts "FertilizerProducts: #{FertilizerProduct.count}" |