Skip to content

Commit

Permalink
Fix consolidation
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoFelipe committed Jan 4, 2024
1 parent 5c4df96 commit 2f1f999
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/models/admissions/admission_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ def consolidate_phase(phase)
if phase.consolidation_form.present?
field_objects = self.fields_hash
committees = self.evaluations.where(admission_phase_id: phase.id).map do |ev|
ev.filled_form.to_fields_hash.map(&:simple_value)
ev.filled_form.to_fields_hash.map do |k, v|
[k, v.simple_value]
end.to_h
end
vars = {
process: self.admission_process,
Expand Down
4 changes: 3 additions & 1 deletion app/models/admissions/form_condition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class Admissions::FormCondition < ActiveRecord::Base
AND = record_i18n_attr("modes.and")
OR = record_i18n_attr("modes.or")
CONDITION = record_i18n_attr("modes.condition")
MODES = [AND, OR, CONDITION]
NONE = record_i18n_attr("modes.none")
MODES = [AND, OR, CONDITION, NONE]

CONTAINS = record_i18n_attr("conditions.contains")
STARTS_WITH = record_i18n_attr("conditions.starts_with")
Expand Down Expand Up @@ -116,6 +117,7 @@ def compare(first, second, field)

def self.check_truth(condition, should_raise: nil, default: true, &block)
return default if condition.nil?
return default if condition.mode == NONE
case condition.mode
when AND
condition.form_conditions.all? do |child|
Expand Down
1 change: 1 addition & 0 deletions config/locales/admissions/form_condition.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pt-BR:
and: E
or: Ou
condition: Condição
none: Nenhuma
condition: "Condição"
conditions:
contains: "Contém"
Expand Down

0 comments on commit 2f1f999

Please sign in to comment.