Skip to content

Commit

Permalink
error catching on latest_income
Browse files Browse the repository at this point in the history
  • Loading branch information
drkane committed Apr 12, 2020
1 parent 6d51b16 commit cd99d8b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion data_import/import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,14 @@ def clean_char(char):
if n:
w = n.split()
words.update([" ".join(w[r:]) for r in range(len(w))])

try:
weight = max(1, math.ceil(math.log1p((char.get("latest_income", 0) or 0))))
except ValueError:
weight = 1
char["complete_names"] = {
"input": list(words),
"weight": max(1, math.ceil(math.log1p((char.get("latest_income", 0) or 0))))
"weight": weight,
}

char["last_modified"] = datetime.datetime.now()
Expand Down

0 comments on commit cd99d8b

Please sign in to comment.