-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctif: ETQ admin, je souhaite pouvoir utiliser des champs public pour conditionner une annotation privée #10503
Conversation
…hamp_public on condition for types_de_champ_private
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10503 +/- ##
==========================================
- Coverage 80.89% 80.88% -0.01%
==========================================
Files 1211 1211
Lines 25612 25635 +23
Branches 4623 4632 +9
==========================================
+ Hits 20719 20736 +17
- Misses 4893 4899 +6 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pas tout pigé, mais d'après les tests ça a l'air bien ;)
tdcs | ||
.map.with_index | ||
.filter_map { |tdc, i| tdc.condition? ? [tdc, i] : nil } | ||
.map do |tdc, i| | ||
[tdc, tdc.condition.errors(public_tdcs.take(i))] | ||
[tdc, tdc.condition.errors(tdcs.take(i))] | ||
end | ||
.filter { |_tdc, errors| errors.present? } | ||
.each do |tdc, _error_hash| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiens à l'occas on pourra essayer de refactorer cet enchainement pour éviter autant de boucles et allocations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
peut-être que ça marche :
tdcs | |
.map.with_index | |
.filter_map { |tdc, i| tdc.condition? ? [tdc, i] : nil } | |
.map do |tdc, i| | |
[tdc, tdc.condition.errors(public_tdcs.take(i))] | |
[tdc, tdc.condition.errors(tdcs.take(i))] | |
end | |
.filter { |_tdc, errors| errors.present? } | |
.each do |tdc, _error_hash| | |
tdcs.each_with_index do |tdc, i| | |
next unless tdc.condition? | |
errors = tdc.condition.errors(tdcs.take(i)) | |
next if errors.blank? | |
procedure.errors.add( | |
attribute, | |
procedure.errors.generate_message(attribute, :invalid_condition, { value: tdc.libelle }), | |
type_de_champ: tdc | |
) | |
end |
spec/models/procedure_spec.rb
Outdated
|
||
it 'validates that types de champ private condition works types de champ public and private' do | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it 'validates that types de champ private condition works types de champ public and private' do | |
end |
71c418e
to
e238c9b
Compare
e238c9b
to
86bb346
Compare
…blic on condition for types_de_champ_private
86bb346
to
27b86f9
Compare
ab522a3
No description provided.