|
@@ -98,7 +98,7 @@ class Result(BaseModel):
|
|
|
|
|
|
self.origin = origin
|
|
|
self.origin_user = origin_user
|
|
|
- self.reset_confirmations()
|
|
|
+ self.reset_confirmations(commit=False)
|
|
|
|
|
|
@commit_on_return
|
|
|
def set_label(self, label: int):
|
|
@@ -109,7 +109,7 @@ class Result(BaseModel):
|
|
|
:return:
|
|
|
"""
|
|
|
if self.label_id != label:
|
|
|
- self.reset_confirmations()
|
|
|
+ self.reset_confirmations(commit=False)
|
|
|
self.label_id = label
|
|
|
|
|
|
@property
|
|
@@ -130,6 +130,7 @@ class Result(BaseModel):
|
|
|
|
|
|
return _confirmations
|
|
|
|
|
|
+ @commit_on_return
|
|
|
def reset_confirmations(self) -> T.List[ResultConfirmation]:
|
|
|
"""
|
|
|
Resets all confirmations
|
|
@@ -139,8 +140,8 @@ class Result(BaseModel):
|
|
|
confirmations = ResultConfirmation.query.filter(
|
|
|
ResultConfirmation.result_id == self.id)
|
|
|
|
|
|
- _confirmations = [c.serialize() for c in confirmations.all()]
|
|
|
- confirmations.delete()
|
|
|
+ # delete returns the serialized object
|
|
|
+ _confirmations = [c.delete(commit=False) for c in confirmations.all()]
|
|
|
|
|
|
return _confirmations
|
|
|
|