From fecc704fe108e432043f8b435cef40733c7efd59 Mon Sep 17 00:00:00 2001 From: Trenton Holmes <797416+stumpylog@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:12:25 -0800 Subject: [PATCH] Don't parse the barcodes twice, store the result instead --- src/documents/tasks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/documents/tasks.py b/src/documents/tasks.py index 19e40db5b..abb9cd39d 100644 --- a/src/documents/tasks.py +++ b/src/documents/tasks.py @@ -152,10 +152,13 @@ def consume_file( return "File successfully split" # try reading the ASN from barcode - if settings.CONSUMER_ENABLE_ASN_BARCODE and reader.asn is not None: + if ( + settings.CONSUMER_ENABLE_ASN_BARCODE + and (located_asn := reader.asn) is not None + ): # Note this will take precedence over an API provided ASN # But it's from a physical barcode, so that's good - overrides.asn = reader.asn + overrides.asn = located_asn logger.info(f"Found ASN in barcode: {overrides.asn}") template_overrides = Consumer().get_workflow_overrides(