Skip to content

Commit 90a22ca

Browse files
committed
The updated file
1 parent 9f846bc commit 90a22ca

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

homework.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def get_week_stats(self):
3939
total_week_amount += record.amount
4040
return total_week_amount
4141

42+
def get_today_limit(self):
43+
return self.limit - self.get_today_stats()
44+
4245

4346
class CashCalculator(Calculator):
4447
USD_RATE = 73.20
@@ -50,17 +53,10 @@ def __init__(self, limit):
5053

5154
def get_today_cash_remained(self, currency):
5255
self.currency = currency
53-
56+
t_amount = self.get_today_limit()
5457
rub_currency = 'руб'
5558
usd_currency = 'USD'
5659
eur_currency = 'Euro'
57-
58-
t_amount = 0
59-
for record in self.records:
60-
if record.date == now.date():
61-
t_amount += record.amount
62-
t_amount = self.limit - t_amount
63-
6460
wrong_currency_message = 'Указана неверная валюта. Повторите ввод.'
6561
positive_message = 'На сегодня осталось'
6662
neutral_message = 'Денег нет, держись'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy