feat: add production debug config and enhance data handling

Introduced a new debug configuration for production mode in VSCode, facilitating easier debugging in different environments. Additionally, updated the `get_transparency_data` function to handle year and month as strings, ensuring compatibility with subsequent operations. Added a necessary parameter to a function call in `main.py` to align with the updated function signature.
This commit is contained in:
Kumi 2024-07-01 07:04:47 +02:00
parent a37e8ec5c3
commit 1acc142dba
Signed by: kumi
GPG key ID: ECBCC9082395383F
3 changed files with 13 additions and 2 deletions

10
.vscode/launch.json vendored
View file

@ -5,7 +5,7 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "Python Debugger", "name": "Debug: Development Mode",
"type": "debugpy", "type": "debugpy",
"request": "launch", "request": "launch",
"program": "main.py", "program": "main.py",
@ -14,6 +14,14 @@
"env": { "env": {
"PRIVATECOFFEE_DEV": "1" "PRIVATECOFFEE_DEV": "1"
} }
},
{
"name": "Debug: Production Mode",
"type": "debugpy",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}"
} }
] ]
} }

View file

@ -29,6 +29,9 @@ def get_transparency_data(data, year=None, month=None, allow_current=False):
if month is None: if month is None:
month = max(data[year].keys()) month = max(data[year].keys())
year = str(year)
month = str(month)
if ( if (
not allow_current not allow_current
and year == str(datetime.now().year) and year == str(datetime.now().year)

View file

@ -62,7 +62,7 @@ def catch_all(path):
finances_table = generate_transparency_table( finances_table = generate_transparency_table(
get_transparency_data( get_transparency_data(
finances, finances_year, finances_month finances, finances_year, finances_month, allow_current
) )
) )