Skip to content

Commit

Permalink
Affiche l'erreur que s'il y en a (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdauphant authored and Lucien Pereira committed Dec 23, 2019
1 parent 5e880e8 commit 93a5e61
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/controllers/CSVImportController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,14 @@ case class CSVImportController @Inject()(loginAction: LoginAction,
val (alreadyExistingUsersErrors, filteredUserGroupInformation) = CsvHelper.filterAlreadyExistingUsersAndGenerateErrors(augmentedUserGroupInformation)

val currentDate = Time.now()
val formWithError = importUsersReviewFrom(currentDate)
val formWithData = importUsersReviewFrom(currentDate)
.fillAndValidate(filteredUserGroupInformation)
.withGlobalError("Certaines lignes du CSV n'ont pas pu être importé", userNotImported ++ alreadyExistingUsersErrors :_*) // TODO : Only if errors

val formWithError = if(userNotImported.nonEmpty || alreadyExistingUsersErrors.nonEmpty) {
formWithData.withGlobalError("Certaines lignes du CSV n'ont pas pu être importé", userNotImported ++ alreadyExistingUsersErrors: _*)
} else {
formWithData
}
Ok(views.html.reviewUsersImport(request.currentUser)(formWithError))
})
})
Expand Down

0 comments on commit 93a5e61

Please sign in to comment.