From ff0cfb0dfb7da25664e39167acfd13743aebbaa9 Mon Sep 17 00:00:00 2001
From: kentsanggds <ken.tsang@digital.cabinet-office.gov.uk>
Date: Thu, 3 Oct 2024 16:21:27 +0100
Subject: [PATCH] Get harvest_object_id from harvest element first

Getting from the extra field doesn't return the latest update
---
 app/services/ckan/v26/inspire_mapper.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/services/ckan/v26/inspire_mapper.rb b/app/services/ckan/v26/inspire_mapper.rb
index 2f8962e7..ba9ddc7a 100644
--- a/app/services/ckan/v26/inspire_mapper.rb
+++ b/app/services/ckan/v26/inspire_mapper.rb
@@ -11,7 +11,7 @@ def call(package)
           coupled_resource: package.get_extra("coupled-resource"),
           dataset_reference_date: package.get_extra("dataset-reference-date"),
           frequency_of_update: package.get_extra("frequency-of-update"),
-          harvest_object_id: package.get_extra("harvest_object_id") || package.get_harvest("harvest_object_id"),
+          harvest_object_id: package.get_harvest("harvest_object_id") || package.get_extra("harvest_object_id"),
           harvest_source_reference: package.get_extra("harvest_source_reference"),
           import_source: package.get_extra("import_source"),
           metadata_date: package.get_extra("metadata-date", 10),