|
@@ -161,13 +161,16 @@ class Result(BaseModel):
|
|
|
if self.origin == "pipeline":
|
|
|
self.set_origin(origin="user", origin_user=user)
|
|
|
|
|
|
- # Get current confirmations.
|
|
|
- confirmations = self.confirmations
|
|
|
+ # Get current confirmations by given user.
|
|
|
+ confirmations_by_user = ResultConfirmation.query.filter(
|
|
|
+ ResultConfirmation.result_id == self.id,
|
|
|
+ ResultConfirmation.confirming_user == user)
|
|
|
+ _confirmations_by_user = [c.serialize() for c in confirmations_by_user.all()]
|
|
|
|
|
|
# Results can only be confirmed if the result is labeled.
|
|
|
# Also, the original annotator cannot confirm the result and we want
|
|
|
# to avoid duplicates.
|
|
|
- if self.label_id is not None and self.origin_user != user and not len(confirmations) > 0:
|
|
|
+ if self.label_id is not None and self.origin_user != user and not len(_confirmations_by_user) > 0:
|
|
|
ResultConfirmation.new(commit=False,
|
|
|
result_id=self.id,
|
|
|
confirming_user=user)
|