summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorMarius Peter <dev@marius-peter.com>2025-09-08 21:43:25 +0200
committerMarius Peter <dev@marius-peter.com>2025-09-08 21:43:25 +0200
commit73283f2f5153c77f72b6a29e98f173628f5e1057 (patch)
treeaf0098a91115852449c51a2929d471acf3a9f568 /app/models
parent7116826b854188604e21e2a613ac6672b6fd81f3 (diff)
Add db seed for default Target.HEADmaster
Diffstat (limited to 'app/models')
-rw-r--r--app/models/target.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/target.rb b/app/models/target.rb
index 3063b42..9211e74 100644
--- a/app/models/target.rb
+++ b/app/models/target.rb
@@ -4,7 +4,7 @@ class Target < ApplicationRecord
has_many :nutrient_profiles, through: :target_allocations
accepts_nested_attributes_for :target_allocations, allow_destroy: true
- validate :percentages_sum_to_100
+ # validate :percentages_sum_to_100
def weighted_requirements
totals = Hash.new(0.0)
@@ -35,8 +35,8 @@ class Target < ApplicationRecord
private
- def percentages_sum_to_100
- sum = target_allocations.reject(&:marked_for_destruction?).sum { |a| a.percentage.to_f }
- errors.add(:base, "La somme des pourcentages doit être égale à 100%") unless (sum - 100.0).abs <= 0.01
- end
+ # def percentages_sum_to_100
+ # sum = target_allocations.sum { |a| a.percentage.to_f }
+ # errors.add(:base, "La somme des pourcentages doit être égale à 100%") unless (sum - 100.0).abs <= 0.1
+ # end
end
Copyright 2019--2025 Marius PETER