fix typing issue when videos have no votes and their vote count is None not 0 in metadata, resolves #50
This commit is contained in:
parent
5348e25303
commit
3567e20600
|
@ -984,8 +984,12 @@ class Media(models.Model):
|
|||
def votes(self):
|
||||
field = self.get_metadata_field('upvotes')
|
||||
upvotes = self.loaded_metadata.get(field, 0)
|
||||
if not isinstance(upvotes, int):
|
||||
upvotes = 0
|
||||
field = self.get_metadata_field('downvotes')
|
||||
downvotes = self.loaded_metadata.get(field, 0)
|
||||
if not isinstance(downvotes, int):
|
||||
downvotes = 0
|
||||
return upvotes + downvotes
|
||||
|
||||
@property
|
||||
|
|
Loading…
Reference in New Issue