Skip to content

Commit

Permalink
remove rollback does not work here
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrOertlin committed Apr 12, 2024
1 parent b714784 commit 8c60231
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions genotype_api/services/endpoint_services/plate_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,20 @@ def upload_plate(self, file: UploadFile) -> None:
file_name=str(file_name),
include_key="-CG-",
)
try:
plate_obj = Plate(plate_id=plate_id)
plate: Plate = self.store.create_plate(plate=plate_obj)
new_plate: Plate = self.store.get_plate_by_plate_id(plate_id=plate_id)
analyses: list[Analysis] = list(excel_parser.generate_analyses(plate_id=new_plate.id))
self.store.check_analyses_objects(analyses=analyses, analysis_type=Types.GENOTYPE)
self.store.create_analyses_samples(analyses=analyses)
for analysis in analyses:
self.store.create_analysis(analysis=analysis)
plate_obj.analyses = analyses
for analysis in analyses:
sample: Sample = self.store.get_sample_by_id(sample_id=analysis.sample_id)
self.store.refresh_sample_status(sample=sample)
self.store.refresh_plate(plate=plate)
except Exception as error:
logging.debug(error)
self.store.session.rollback()

plate_obj = Plate(plate_id=plate_id)
plate: Plate = self.store.create_plate(plate=plate_obj)
new_plate: Plate = self.store.get_plate_by_plate_id(plate_id=plate_id)
analyses: list[Analysis] = list(excel_parser.generate_analyses(plate_id=new_plate.id))
self.store.check_analyses_objects(analyses=analyses, analysis_type=Types.GENOTYPE)
self.store.create_analyses_samples(analyses=analyses)
for analysis in analyses:
self.store.create_analysis(analysis=analysis)
plate_obj.analyses = analyses
for analysis in analyses:
sample: Sample = self.store.get_sample_by_id(sample_id=analysis.sample_id)
self.store.refresh_sample_status(sample=sample)
self.store.refresh_plate(plate=plate)

def update_plate_sign_off(
self, plate_id: int, user_email: EmailStr, method_document: str, method_version: str
Expand Down

0 comments on commit 8c60231

Please sign in to comment.