fix(data): standardize month formatting to two digits
All checks were successful
Build and Deploy Static Site (Pride Theme) / build (push) Successful in 1m10s
Build and Deploy Static Site / build (push) Successful in 58s

Updated the month keys in the `finances.json` file to use a two-digit format. Adjusted the `get_transparency_data` function to accommodate this change by zero-padding single-digit months. This ensures consistency in data representation and prevents potential errors in handling financial data.
This commit is contained in:
Kumi 2024-10-04 07:33:25 +02:00
parent 2ce269136f
commit cabb095028
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 17 additions and 9 deletions

View file

@ -1,6 +1,6 @@
{
"2024": {
"4": {
"04": {
"Membership Fees": {
"EUR": 365
},
@ -12,7 +12,7 @@
"Notes": "Administrative fee for the formation of the association"
}
},
"5": {
"05": {
"Membership Fees": {
"EUR": 390
},
@ -25,7 +25,7 @@
"Notes": "Includes setup costs and two monthly payments for new server"
}
},
"6": {
"06": {
"Membership Fees": {
"EUR": 382.42
},
@ -36,7 +36,7 @@
"EUR": -49.05
}
},
"7": {
"07": {
"Membership Fees": {
"EUR": 422.42
},
@ -47,7 +47,7 @@
"EUR": -264.99
}
},
"8": {
"08": {
"Membership Fees": {
"EUR": 402.42
},
@ -55,12 +55,20 @@
"EUR": -416.47
}
},
"9": {
"09": {
"Membership Fees": {
"EUR": 448.11
"EUR": 468.11
},
"Server Costs": {
"EUR": -243.46
},
"Bank Fees": {
"EUR": -53.32
}
},
"10": {
"Membership Fees": {
"EUR": 30.23
}
}
}

View file

@ -30,12 +30,12 @@ def get_transparency_data(data, year=None, month=None, allow_current=False):
month = max(data[year].keys())
year = str(year)
month = str(month)
month = str(month).zfill(2)
if (
not allow_current
and year == str(datetime.now().year)
and month == str(datetime.now().month)
and month == str(datetime.now().month).zfill(2)
):
try:
month = max([m for m in data[year].keys() if m != str(datetime.now().month)])