@@ -375,8 +375,8 @@ def _update_barcode_meta(self, sample_id, barcode_meta):
375
375
"sample_site_last_washed_product) "
376
376
"VALUES (%s, %s, %s, %s)" ,
377
377
(sample_id , barcode_meta ['sample_site_last_washed_date' ],
378
- barcode_meta ['sample_site_last_washed_time' ],
379
- barcode_meta ['sample_site_last_washed_product' ])
378
+ barcode_meta ['sample_site_last_washed_time' ],
379
+ barcode_meta ['sample_site_last_washed_product' ])
380
380
)
381
381
382
382
def _get_barcode_meta (self , sample_id ):
@@ -591,32 +591,31 @@ def _validate_barcode_meta(self, sample_site, barcode_meta):
591
591
if sample_site != "Cheek" :
592
592
return False
593
593
594
- with self ._transaction .dict_cursor () as cur :
595
- ret_dict = {}
596
- bc_valid = True
597
- for fn , fv in barcode_meta .items ():
598
- if fn == "sample_site_last_washed_date" :
599
- try :
600
- ret_val = datetime .datetime .strptime (
601
- fv ,
602
- "%m/%d/%Y"
603
- )
604
- ret_dict [fn ] = ret_val
605
- except ValueError :
606
- bc_valid = False
607
- elif fn == "sample_site_last_washed_time" :
608
- try :
609
- ret_val = datetime .datetime .strptime (
610
- fv ,
611
- "%I:%M %p"
612
- )
613
- ret_dict [fn ] = ret_val
614
- except ValueError :
615
- bc_valid = False
616
- elif fn == "sample_site_last_washed_product" :
617
- # The ENUM type in the database will validate the value
618
- ret_dict [fn ] = fv
619
- else :
594
+ ret_dict = {}
595
+ bc_valid = True
596
+ for fn , fv in barcode_meta .items ():
597
+ if fn == "sample_site_last_washed_date" :
598
+ try :
599
+ ret_val = datetime .datetime .strptime (
600
+ fv ,
601
+ "%m/%d/%Y"
602
+ )
603
+ ret_dict [fn ] = ret_val
604
+ except ValueError :
605
+ bc_valid = False
606
+ elif fn == "sample_site_last_washed_time" :
607
+ try :
608
+ ret_val = datetime .datetime .strptime (
609
+ fv ,
610
+ "%I:%M %p"
611
+ )
612
+ ret_dict [fn ] = ret_val
613
+ except ValueError :
620
614
bc_valid = False
615
+ elif fn == "sample_site_last_washed_product" :
616
+ # The ENUM type in the database will validate the value
617
+ ret_dict [fn ] = fv
618
+ else :
619
+ bc_valid = False
621
620
622
- return False if bc_valid is False else ret_dict
621
+ return False if bc_valid is False else ret_dict
0 commit comments