Don't parse the barcodes twice, store the result instead

This commit is contained in:
Trenton Holmes 2024-01-05 20:12:25 -08:00 committed by Trenton H
parent 569beba348
commit fecc704fe1

View File

@ -152,10 +152,13 @@ def consume_file(
return "File successfully split" return "File successfully split"
# try reading the ASN from barcode # 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 # Note this will take precedence over an API provided ASN
# But it's from a physical barcode, so that's good # 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}") logger.info(f"Found ASN in barcode: {overrides.asn}")
template_overrides = Consumer().get_workflow_overrides( template_overrides = Consumer().get_workflow_overrides(