mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-02 06:21:09 +00:00
Catch value errors when parsing imported ratings
This commit is contained in:
parent
8cf7c5c392
commit
c77436fc12
1 changed files with 5 additions and 2 deletions
|
@ -252,9 +252,12 @@ class ImportItem(models.Model):
|
||||||
@property
|
@property
|
||||||
def rating(self):
|
def rating(self):
|
||||||
"""x/5 star rating for a book"""
|
"""x/5 star rating for a book"""
|
||||||
if self.normalized_data.get("rating"):
|
if not self.normalized_data.get("rating"):
|
||||||
|
return None
|
||||||
|
try:
|
||||||
return float(self.normalized_data.get("rating"))
|
return float(self.normalized_data.get("rating"))
|
||||||
return None
|
except ValueError:
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def date_added(self):
|
def date_added(self):
|
||||||
|
|
Loading…
Reference in a new issue