Skip to content

Commit d55df1c

Browse files
committed
Allow name accessions in publications
1 parent 8a94482 commit d55df1c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

app/models/register/status.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ def automated_validation
282282
def check_pdf_files
283283
has_acc = false
284284
inames = Hash[names.map { |n| [n, false] }]
285+
anames = Hash[names.map { |n| [n, false] }]
285286
[publication_pdf, supplementary_pdf].each do |as|
286287
break if has_acc && inames.values.all?
287288
next unless as.attached?
@@ -295,19 +296,20 @@ def check_pdf_files
295296
bn = n.base_name
296297
cn = n.corrigendum_from
297298
inames[n] = true if txt.index(bn) || (cn && txt.index(cn))
299+
anames[n] = true if txt.index(n.seqcode_url(false))
298300
end
299-
break if has_acc && inames.values.all?
301+
break if (has_acc || anames.values.all?) && inames.values.all?
300302
end
301303
end
302304
end
303305

304306
names.each do |n|
305-
Check.create_with(pass: has_acc).find_or_create_by(
307+
v = has_acc || anames[n]
308+
Check.create_with(pass: v).find_or_create_by(
306309
name: n, kind: :effective_publication_missing_accession
307-
).update(pass: has_acc)
308-
end
310+
).update(pass: v)
309311

310-
inames.each do |n, v|
312+
v = inames[n]
311313
Check.create_with(pass: v).find_or_create_by(
312314
name: n, kind: :name_missing_in_effective_publication
313315
).update(pass: v)
@@ -316,5 +318,8 @@ def check_pdf_files
316318
add_note('The effective publication files have been parsed')
317319

318320
has_acc && inames.values.all?
321+
rescue => e
322+
add_note('ERROR: The effective publication files could not be parsed')
323+
raise e
319324
end
320325
end

0 commit comments

Comments
 (0)