From 287e49eba16559268b36832551649fede37aebe3 Mon Sep 17 00:00:00 2001 From: Payten Giles Date: Tue, 28 Jul 2020 10:27:46 +1000 Subject: [PATCH] Fix 'bulk' method missing error when resource has a bulk date (conflicts with ASModel::ChangeTracking) --- backend/model/ladybird_export.rb | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/backend/model/ladybird_export.rb b/backend/model/ladybird_export.rb index 95d1902..18aa9a8 100644 --- a/backend/model/ladybird_export.rb +++ b/backend/model/ladybird_export.rb @@ -287,12 +287,6 @@ def prepare_resource_creation_dates .select(:id) .first[:id] - bulk_type_enum_id = EnumerationValue - .filter(:enumeration_id => Enumeration.filter(:name => 'date_type').select(:id)) - .filter(:value => 'bulk') - .select(:id) - .first[:id] - ASDate .filter(:date__resource_id => @resource_id) .select(:resource_id, @@ -306,10 +300,6 @@ def prepare_resource_creation_dates @all_resource_dates[row[:resource_id]] << row if row[:label_id] == creation_enum_id - if row[:date_type_id] == bulk_type_enum_id - row[:bulk] = true - end - @resource_creation_dates[row[:resource_id]] ||= [] @resource_creation_dates[row[:resource_id]] << row end @@ -326,12 +316,6 @@ def prepare_ao_creation_dates .select(:id) .first[:id] - bulk_type_enum_id = EnumerationValue - .filter(:enumeration_id => Enumeration.filter(:name => 'date_type').select(:id)) - .filter(:value => 'bulk') - .select(:id) - .first[:id] - ASDate .filter(:date__archival_object_id => @ids) .select(:archival_object_id, @@ -345,10 +329,6 @@ def prepare_ao_creation_dates @all_dates[row[:archival_object_id]] << row if row[:label_id] == creation_enum_id - if row[:date_type_id] == bulk_type_enum_id - row[:bulk] = true - end - @creation_dates[row[:archival_object_id]] ||= [] @creation_dates[row[:archival_object_id]] << row end @@ -826,8 +806,8 @@ def collection_creation_years(row) return if dates.empty? - non_bulk = dates.select{|d| !d[:bulk]} - bulk = dates.select{|d| d[:bulk]}.first + non_bulk = dates.select{|d| d.date_type != 'bulk'} + bulk = dates.find{|d| d.date_type == 'bulk'} def fmt_date(date) date[:expression] || [(date[:begin] || '').sub(/-.*/, ''), (date[:end] || '').sub(/-.*/, '')].select{|d| !d.empty?}.compact.uniq.join('-')