DescriptionController: refactor check_mandatory_fields

This commit is contained in:
Simon Lehericey 2017-03-29 23:18:37 +02:00
parent 191b29aff5
commit d14a75c24a

View file

@ -34,8 +34,7 @@ class Users::DescriptionController < UsersController
@champs = @dossier.ordered_champs @champs = @dossier.ordered_champs
check_mandatory_fields = true check_mandatory_fields = !draft_submission?
check_mandatory_fields = !(params[:submit].keys.first == 'brouillon') if params[:submit]
if params[:champs] if params[:champs]
champs_service_errors = ChampsService.save_champs @dossier.champs, champs_service_errors = ChampsService.save_champs @dossier.champs,
@ -116,6 +115,10 @@ class Users::DescriptionController < UsersController
private private
def draft_submission?
params[:submit] && params[:submit].keys.first == 'brouillon'
end
def check_autorisation_donnees def check_autorisation_donnees
@dossier = current_user_dossier @dossier = current_user_dossier