diff --git a/app/controllers/DraftMetadataChecksResultsController.scala b/app/controllers/DraftMetadataChecksResultsController.scala index 09acbb566..3ed2593e7 100644 --- a/app/controllers/DraftMetadataChecksResultsController.scala +++ b/app/controllers/DraftMetadataChecksResultsController.scala @@ -97,8 +97,11 @@ class DraftMetadataChecksResultsController @Inject() ( private def getAffectedProperties(errorReport: Option[ErrorFileData]): Set[String] = { errorReport match { - case Some(er) if er.fileError == FileError.SCHEMA_REQUIRED => er.validationErrors.flatMap(_.errors.map(_.property)).toSet - case _ => Set() + case Some(er) + if er.fileError == FileError.SCHEMA_REQUIRED + || er.fileError == FileError.DUPLICATE_HEADER => + er.validationErrors.flatMap(_.errors.map(_.property)).toSet + case _ => Set() } } diff --git a/app/services/DraftMetadataService.scala b/app/services/DraftMetadataService.scala index aca45c3dc..4dc837c4d 100644 --- a/app/services/DraftMetadataService.scala +++ b/app/services/DraftMetadataService.scala @@ -17,7 +17,7 @@ import scala.concurrent.{ExecutionContext, Future} object FileError extends Enumeration { type FileError = Value - val UTF_8, INVALID_CSV, SCHEMA_REQUIRED, SCHEMA_VALIDATION, VIRUS, UNKNOWN, NONE = Value + val UTF_8, INVALID_CSV, DUPLICATE_HEADER, SCHEMA_REQUIRED, SCHEMA_VALIDATION, VIRUS, UNKNOWN, NONE = Value } case class Error(validationProcess: String, property: String, errorKey: String, message: String) diff --git a/conf/messages b/conf/messages index bf7523def..27cb633bb 100644 --- a/conf/messages +++ b/conf/messages @@ -46,3 +46,5 @@ draftMetadata.validation.details.VIRUS=A virus was found in your metadata file. draftMetadata.validation.action.VIRUS=Please get in touch on tdr@nationalarchives.gov.uk, so that we can validate this before contacting your own internal support. draftMetadata.validation.details.SCHEMA_REQUIRED=There was at least one missing column in your metadata file. The metadata file must contain specific column headers. draftMetadata.validation.action.SCHEMA_REQUIRED=Add the following column headers to your metadata file and re-load. +draftMetadata.validation.details.DUPLICATE_HEADER=There was at least one duplicate column in your metadata file. +draftMetadata.validation.action.DUPLICATE_HEADER=Ensure there is only one of the following duplicated columns. diff --git a/test/controllers/DraftMetadataChecksResultsControllerSpec.scala b/test/controllers/DraftMetadataChecksResultsControllerSpec.scala index bf2496a37..0b6aa6f04 100644 --- a/test/controllers/DraftMetadataChecksResultsControllerSpec.scala +++ b/test/controllers/DraftMetadataChecksResultsControllerSpec.scala @@ -198,6 +198,13 @@ class DraftMetadataChecksResultsControllerSpec extends FrontEndTestHelper { "There was at least one missing column in your metadata file. The metadata file must contain specific column headers.", "Add the following column headers to your metadata file and re-load.", Set("Closure Status", "Description") + ), + ( + CompletedWithIssuesValue.value, + FileError.DUPLICATE_HEADER, + "There was at least one duplicate column in your metadata file.", + "Ensure there is only one of the following duplicated columns.", + Set("Closure Status", "Description") ) ) forAll(draftMetadataStatuses) { (statusValue, fileError, detailsMessage, actionMessage, affectedProperties) =>