Skip to content

Commit

Permalink
api: fix format_cell for empty strings, use nominal_value
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed May 1, 2021
1 parent d39c090 commit 221ca7e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mpcontribs-api/mpcontribs/api/contributions/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@


def format_cell(cell):
if cell.count(" ") > 1:
cell = cell.strip()
if not cell or cell.count(" ") > 1:
return cell

q = get_quantity(cell)
if not q:
if not q or isnan(q.nominal_value):
return cell

q = truncate_digits(q)
return str(q.value) if isnan(q.std_dev) else str(q)
return str(q.nominal_value) if isnan(q.std_dev) else str(q)


def new_error_units(measurement, quantity):
Expand Down

0 comments on commit 221ca7e

Please sign in to comment.