Skip to content

Commit 0e90ba3

Browse files
committed
Move check so that we can get the count of PDC for non-org files
1 parent f36b446 commit 0e90ba3

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

apps/transport/lib/irve/simple_consolidation.ex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ defmodule Transport.IRVE.SimpleConsolidation do
7171
# optionally, for dev especially, we can keep files around until we manually delete them
7272
use_permanent_disk_cache = Application.get_env(:transport, :irve_consolidation_caching, false)
7373

74-
# Raise if the producer is not an organization. This check is not in the validator itself:
75-
# it’s not linked to the file content/format, but to how it is published on data.gouv.fr.
76-
Transport.IRVE.RawStaticConsolidation.ensure_producer_is_org!(resource)
77-
7874
path = storage_path(resource.resource_id)
7975
extension = Path.extname(resource.url)
8076

@@ -89,6 +85,12 @@ defmodule Transport.IRVE.SimpleConsolidation do
8985
# But currently if a cheap check fails, an exception is thrown, and we would lose the estimated PDC count,
9086
# something which is essential to report on for our current work.
9187
try do
88+
# Raise if the producer is not an organization. This check is not in the validator itself:
89+
# it’s not linked to the file content/format, but to how it is published on data.gouv.fr.
90+
# it is done after downloading the file in order to be able to report on the potential
91+
# loss of PDC count.
92+
Transport.IRVE.RawStaticConsolidation.ensure_producer_is_org!(resource)
93+
9294
validation_result = Transport.IRVE.Validator.validate(path, extension)
9395
file_valid? = validation_result |> Transport.IRVE.Validator.full_file_valid?()
9496

0 commit comments

Comments
 (0)