Skip to content

Commit

Permalink
Masque la scolarité lors du retrait de DA
Browse files Browse the repository at this point in the history
  • Loading branch information
tnicolas1 committed Jan 27, 2025
1 parent 4552d30 commit ddff12d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/schoolings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def confirm_removal; end
def confirm_removal_cancellation; end

def remove
@schooling.update!(removed_at: params[:removed_at])
@schooling.remove

redirect_to school_year_class_path(selected_school_year, @classe), notice: t("flash.schooling.#{params[:notice]}",
name: @schooling.student,
Expand Down
3 changes: 3 additions & 0 deletions app/jobs/generate/cancellation_decision_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ class MissingAttributiveDecisionError < StandardError
def perform(schooling)
raise MissingAttributiveDecisionError if schooling.attributive_decision.blank?

Sync::StudentJob.new.perform(schooling)

Schooling.transaction do
generate_document(schooling)
rectify_pfmp_if_necessary(schooling)
schooling.remove
schooling.save!
end
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/schooling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ def excluded?
Exclusion.excluded?(establishment.uai, mef.code)
end

def remove(date = Date.current)
self.update_attribute(:removed_at, date)
end

def removed?
removed_at.present?
end
Expand Down

0 comments on commit ddff12d

Please sign in to comment.