@@ -60,18 +60,18 @@ def batch_processing(
6060 logging .info (
6161 f"Successfully found open '{ batch_type } - { batch_description } ' batch"
6262 )
63- if not get_subjects_from_pdf :
64- logging .info (f"Getting NHS Numbers for batch { link_text } from the DB" )
65- nhs_no_df = get_nhs_no_from_batch_id (link_text )
6663 link .click ()
6764 break
6865 elif (i + 1 ) == batch_description_cells .count ():
6966 pytest .fail (f"No open '{ batch_type } - { batch_description } ' batch found" )
7067
7168 if get_subjects_from_pdf :
69+ logging .info (f"Getting NHS Numbers for batch { link_text } from the PDF File" )
7270 nhs_no_df = prepare_and_print_batch (page , link_text , get_subjects_from_pdf )
7371 else :
72+ logging .info (f"Getting NHS Numbers for batch { link_text } from the DB" )
7473 prepare_and_print_batch (page , link_text , get_subjects_from_pdf )
74+ nhs_no_df = get_nhs_no_from_batch_id (link_text )
7575
7676 check_batch_in_archived_batch_list (page , link_text )
7777
@@ -109,8 +109,11 @@ def prepare_and_print_batch(
109109 file = download_file .suggested_filename
110110 # Wait for the download process to complete and save the downloaded file in a temp folder
111111 download_file .save_as (file )
112- if file .endswith (".pdf" ) and get_subjects_from_pdf :
113- nhs_no_df = extract_nhs_no_from_pdf (file )
112+ nhs_no_df = (
113+ extract_nhs_no_from_pdf (file )
114+ if file .endswith (".pdf" ) and get_subjects_from_pdf
115+ else None
116+ )
114117 os .remove (file ) # Deletes the file after extracting the necessary data
115118 except Exception as e :
116119 pytest .fail (f"No retrieve button available to click: { str (e )} " )
0 commit comments