Skip to content

Commit

Permalink
ISSUE #448: Correction at affiliation initial date error
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMonardez committed Jan 9, 2025
1 parent a84b22d commit 6fa6d4d
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions db/migrate/20240524135850_create_affiliation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,13 @@ def up
elsif professor.institution_id == institution_id || ((end_date - start_date) <= 1.month)
affiliation.update(start_date: start_date)
end
# Se for a primeira versão do professor pega a data da primeira tese do professor e diminui um mês
if professor.paper_trail.previous_version.nil?
if initial_start_date.nil?
affiliation.update(start_date: start_date - 1.month)
else
affiliation.update(start_date: initial_start_date - 1.month)
end
break
end
professor = professor.paper_trail.previous_version
end
if initial_start_date.nil? || initial_start_date >= start_date
affiliation.update(start_date: start_date - 1.month)
elsif
affiliation.update(start_date: initial_start_date - 1.month)
end
institutions << { institution_id:, start_date:, end_date: }
end

Expand Down

0 comments on commit 6fa6d4d

Please sign in to comment.