diff --git a/app/uploaders/zizia/csv_manifest_validator.rb b/app/uploaders/zizia/csv_manifest_validator.rb index bf73f0a..c5ee77a 100644 --- a/app/uploaders/zizia/csv_manifest_validator.rb +++ b/app/uploaders/zizia/csv_manifest_validator.rb @@ -72,13 +72,18 @@ def missing_headers end def required_headers(object_type = "w") + return work_headers if object_type.nil? if object_type.casecmp("c").zero? || object_type.casecmp("collection").zero? ['title', 'visibility'] else - ['title', 'creator', 'keyword', 'rights statement', 'visibility', 'files', 'deduplication_key'] + work_headers end end + def work_headers + ['title', 'creator', 'keyword', 'rights statement', 'visibility', 'files', 'deduplication_key'] + end + def duplicate_headers duplicates = [] sorted_headers = @transformed_headers.sort diff --git a/spec/dummy/spec/fixtures/csv_import/good/mix_of_object_types.csv b/spec/dummy/spec/fixtures/csv_import/good/mix_of_object_types.csv index df7a1d0..0661f6c 100644 --- a/spec/dummy/spec/fixtures/csv_import/good/mix_of_object_types.csv +++ b/spec/dummy/spec/fixtures/csv_import/good/mix_of_object_types.csv @@ -4,3 +4,4 @@ Collection,Collection of fruits,,,,public,,def/234 w,Work on tomatoes,"Tomato, Tommy",fruits|~|tomatoes,http://rightsstatements.org/vocab/InC/1.0/,public,birds.jpg,abc/123 wOrk,Work on cabbages,"Cabbage, Carl",vegetables|~|cabbages,http://rightsstatements.org/vocab/InC/1.0/,public,dog.jpg,abs/234 coLLEction,Collection of legumes,,,,public,,def/345 +,Work without object type,"Cabbage, Carl",vegetables|~|cabbages,http://rightsstatements.org/vocab/InC/1.0/,public,dog.jpg,abc/345