Skip to content

Commit

Permalink
Merge pull request #2015 from jonas-lundqvist/comma_decimal
Browse files Browse the repository at this point in the history
Use locale atof when sorting columns
  • Loading branch information
cculianu committed Oct 13, 2020
2 parents 6429bda + c5dc0f5 commit 645394f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions gui/qt/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import webbrowser
from collections import namedtuple
from functools import partial, wraps
from locale import atof

from electroncash.address import Address
from electroncash.util import print_error, PrintError, Weak, finalization_print_error
Expand Down Expand Up @@ -1065,10 +1066,7 @@ def __lt__(self, other):
# We have set custom data to sort by
return self_data < other_data
try:
# Is the value something numeric?
self_text = self.text(column).replace(',', '')
other_text = other.text(column).replace(',', '')
return float(self_text) < float(other_text)
return atof(self.text(column)) < atof(other.text(column))
except ValueError:
# If not, we will just do string comparison
return self.text(column) < other.text(column)
Expand Down

0 comments on commit 645394f

Please sign in to comment.