-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_todays_transactions.py
36 lines (27 loc) · 1.04 KB
/
save_todays_transactions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
""" save_todays_transactions.py
Checks if a new temporary transactions.csv file was generated today and if
so, offers to move it to the permanent transactions.csv file.
This is the last program run by the run-all.sh script.
"""
import shutil
import read_mint_transaction_data as rmtd
# Import shared configuration file
import expenses_config as ec
def move_csv_file(trans):
"""
Moves a transaction csv file that was updated today to the
default mint transaction data if it was updated today and the user approves
"""
todays = rmtd.get_latest_transaction_file(trans, query_user=False)
if todays != trans:
answer = input(
f"Do you want to update {trans} with the newly updated {todays}? (y/n) "
)
if answer.lower() == "y":
# Move file1 to file2
shutil.move(todays, trans)
print(f"{todays} has been moved to {trans}.")
else:
print(f"{trans} was not updated today.")
if __name__ == "__main__":
move_csv_file(ec.PATH_TO_YOUR_TRANSACTIONS)