aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/register.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/register.py b/utils/register.py
index 8ebb5b6..0a103fb 100644
--- a/utils/register.py
+++ b/utils/register.py
@@ -101,6 +101,18 @@ class currencies:
return negated
+ def __lt__(self, other):
+ if len(self.money.values()) != 1 or len(other.money.values()) != 1:
+ raise Exception('Cannot compare multiple currencies at once!')
+
+ for amount_left in self.money.values():
+ break
+ for amount_right in other.money.values():
+ break
+
+ return amount_left < amount_right
+
+
def complete_prices(my_entry: entry):
"""
Transform all string of prices to the class `currencies`. If there is an