movements = load_file(data_file)
ordered_movements = sort_movements(movements)
filtered_movements = mov_filter(ordered_movements, filter)
+ actual_value = Decimal('0')
+ total_expenses = Decimal('0')
+ total_incomes = Decimal('0')
for movement in filtered_movements:
+ movement_value = Decimal(movement[VALUE_FIELD_NAME])
+ actual_value = actual_value + movement_value
+ if movement_value > Decimal('0'):
+ total_incomes = total_incomes + movement_value
+ else:
+ total_expenses = total_expenses + movement_value
formatted_movement = format_movement(movement)
print(formatted_movement)
+ print(value_message(_('actual value: {}'), actual_value))
+ print(value_message(_('total incomes: {}'), total_incomes))
+ print(value_message(_('total expenses: {}'), total_expenses))
+ print(matches_number_message(len(filtered_movements)))
def filter_movements():
"""Writes the latest movements that match a filter formatted.
"""
return _('latest {} movements:').format(n)
+def matches_number_message(n):
+ """Formats the number of movements to show to the user.
+
+ Parameters
+ ----------
+ n : int
+ The number to show to the user.
+
+ Returns
+ -------
+ str
+ A string to show to the user with the number of movements shown.
+
+ """
+ return _('matching movements: {}').format(n)
def value_message(str, value):
return str.format(value)
#
msgid ""
msgstr ""
-"Project-Id-Version: money 2.0.2\n"
+"Project-Id-Version: money 2.0.3\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-09-16 23:15+0200\n"
+"POT-Creation-Date: 2019-09-16 23:45+0200\n"
"PO-Revision-Date: 2018-07-10 23:17+0200\n"
"Last-Translator: <scompo@gmail.com>\n"
"Language-Team: Italian\n"
msgstr "adesso"
#: money/money.py:55
-#, fuzzy
msgid "regex filter"
msgstr "filtro regex"
msgid "data file:"
msgstr "file dati:"
-#: money/money.py:365
-msgid "latest {} movements:"
-msgstr "ultimi {} movimenti:"
-
-#: money/money.py:416
+#: money/money.py:242 money/money.py:444
msgid "actual value: {}"
msgstr "valore attuale: {}"
-#: money/money.py:417
+#: money/money.py:243 money/money.py:445
msgid "total incomes: {}"
msgstr "incassi totali: {}"
-#: money/money.py:418
+#: money/money.py:244 money/money.py:446
msgid "total expenses: {}"
msgstr "spese totali: {}"
+
+#: money/money.py:378
+msgid "latest {} movements:"
+msgstr "ultimi {} movimenti:"
+
+#: money/money.py:394
+msgid "matching movements: {}"
+msgstr "movimenti filtrati: {}"
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-09-16 23:16+0200\n"
+"POT-Creation-Date: 2019-09-16 23:45+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "data file:"
msgstr ""
-#: money/money.py:365
-msgid "latest {} movements:"
-msgstr ""
-
-#: money/money.py:416
+#: money/money.py:242 money/money.py:444
msgid "actual value: {}"
msgstr ""
-#: money/money.py:417
+#: money/money.py:243 money/money.py:445
msgid "total incomes: {}"
msgstr ""
-#: money/money.py:418
+#: money/money.py:244 money/money.py:446
msgid "total expenses: {}"
msgstr ""
+
+#: money/money.py:378
+msgid "latest {} movements:"
+msgstr ""
+
+#: money/money.py:394
+msgid "matching movements: {}"
+msgstr ""
setup(
name='money',
- version='2.0.2',
+ version='2.0.3',
description='Money handling program',
long_description='A python program to handle expenses and incomes',
url='http://code.scompo.it:3000/scompo/money',