From: Mauro Scomparin Date: Mon, 16 Sep 2019 21:53:54 +0000 (+0200) Subject: nuovi X-Git-Url: https://git.scompo.it/?a=commitdiff_plain;h=ec399a5b93d5b93d12c34b6298725364dec02912;p=money.git nuovi --- diff --git a/money/money.py b/money/money.py index 40ccf7e..b33494f 100755 --- a/money/money.py +++ b/money/money.py @@ -227,9 +227,22 @@ def filter_regex_movements(data_file, conf, filter): 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. @@ -364,6 +377,21 @@ def last_movement_number_message(n): """ 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) diff --git a/money/translations/it/LC_MESSAGES/money.mo b/money/translations/it/LC_MESSAGES/money.mo index bf7456f..d976e93 100644 Binary files a/money/translations/it/LC_MESSAGES/money.mo and b/money/translations/it/LC_MESSAGES/money.mo differ diff --git a/money/translations/it/LC_MESSAGES/money.po b/money/translations/it/LC_MESSAGES/money.po index 4cc5c9d..35641ec 100644 --- a/money/translations/it/LC_MESSAGES/money.po +++ b/money/translations/it/LC_MESSAGES/money.po @@ -5,9 +5,9 @@ # 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: \n" "Language-Team: Italian\n" @@ -46,7 +46,6 @@ msgid "now" msgstr "adesso" #: money/money.py:55 -#, fuzzy msgid "regex filter" msgstr "filtro regex" @@ -54,18 +53,22 @@ 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: {}" diff --git a/money/translations/money.pot b/money/translations/money.pot index 68e7a1d..63248b1 100644 --- a/money/translations/money.pot +++ b/money/translations/money.pot @@ -8,7 +8,7 @@ msgid "" 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 \n" "Language-Team: LANGUAGE \n" @@ -53,18 +53,22 @@ msgstr "" 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 "" diff --git a/setup.py b/setup.py index 1ffded9..de5644c 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ here = path.abspath(path.dirname(__file__)) 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',