Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Simplified evidence counts in claim
Browse files Browse the repository at this point in the history
  • Loading branch information
enisbt committed Sep 13, 2018
1 parent 7feee8e commit a9f710a
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions factlist/claims/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,17 @@ class Claim(models.Model):
@property
def true_count(self):
evidences = Evidence.objects.filter(claim=self, conclusion="true", active=True)
if evidences.exists():
return evidences.count()
else:
return 0
return evidences.count()

@property
def false_count(self):
evidences = Evidence.objects.filter(claim=self, conclusion="false", active=True)
if evidences.exists():
return evidences.count()
else:
return 0
return evidences.count()

@property
def inconclusive_count(self):
evidences = Evidence.objects.filter(claim=self, conclusion="inconclusive", active=True)
if evidences.exists():
return evidences.count()
else:
return 0
return evidences.count()

class Meta:
db_table = 'claims'
Expand Down

0 comments on commit a9f710a

Please sign in to comment.