File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,15 @@ namespace :heliotrope do
55
55
# `blank_metadata` is used to enable deletion of existing values. It's *ESSENTIAL* that this hash only contain...
56
56
# fields actually present in the TMM CSV (those known to TMM as mentioned above). Hence the `select`.
57
57
tmm_csv_header_field_names = rows [ 0 ] . to_h . keys . map { |k | k &.strip }
58
- blank_metadata = monograph_fields . select { |field | tmm_csv_header_field_names . include? ( field [ :field_name ] ) }
58
+ blank_metadata = monograph_fields . select { |field | tmm_csv_header_field_names . include? ( field [ :field_name ] ) }
59
59
. pluck ( :metadata_name ) . map { |name | [ name , nil ] } . to_h
60
60
61
+ # michigan and its sub-presses are always allowed
62
+ allowed_presses = Press . where ( parent : Press . where ( subdomain : 'michigan' ) . first ) . map ( &:subdomain ) . push ( 'michigan' )
63
+ # gradually we'll be adding more allowed (non-EBC) presses to the list here
64
+ allowed_presses += [ 'bigten' , 'livedplaces' ]
65
+ allowed_presses . uniq! # just in case
66
+
61
67
rows . each do |row |
62
68
row_num += 1
63
69
@@ -84,7 +90,7 @@ namespace :heliotrope do
84
90
85
91
press = tmm_press_name_map [ press ] if tmm_press_name_map [ press ] . present?
86
92
87
- unless Press . exists? ( subdomain : press )
93
+ unless allowed_presses . include? ( press ) && Press . exists? ( subdomain : press )
88
94
puts "Invalid Press value '#{ press } ' on row #{ row_num } ... SKIPPING ROW"
89
95
next
90
96
end
You can’t perform that action at this time.
0 commit comments