Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/economy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1432,9 +1432,10 @@ def import_csv(self, csvreader):
"24-08-2021";"24-08-2021";"f1a7b16b-27d3-432f-bca7-2e2229";"-59,85";"230.398,91"
"24-08-2021";"24-08-2021";"63e93a24-073b-4ebb-8b0d-5a3072";"-1.221,05";"230.458,76"

The second date column is unused. Dates are in Europe/Copenhagen tz.
The second date column is unused.
Timezone for dates are defined in settings.TIME_ZONE.
"""
cph = ZoneInfo("Europe/Copenhagen")
tz = ZoneInfo(settings.TIME_ZONE)
create_count = 0
# Bank csv has the most recent lines first in the file, and the oldest last.
# Read lines in reverse so we add the earliest transaction first,
Expand All @@ -1445,7 +1446,7 @@ def import_csv(self, csvreader):
# use update_or_create() so we can import a new CSV with the same transactions
# but with updated descriptions, in case we fix a description in the bank
tx, created = self.transactions.update_or_create(
date=datetime.strptime(row[0], "%d/%m/%Y").replace(tzinfo=cph),
date=datetime.strptime(row[0], "%d/%m/%Y").replace(tzinfo=tz),
amount=Decimal(row[3].replace(".", "").replace(",", ".")),
balance=Decimal(row[4].replace(".", "").replace(",", ".")),
defaults={
Expand Down
2 changes: 1 addition & 1 deletion src/economy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from zoneinfo import ZoneInfo

# we need the Danish timezone here and there
cph = ZoneInfo("Europe/Copenhagen")
cph = ZoneInfo(settings.TIME_ZONE)
logger = logging.getLogger(f"bornhack.{__name__}")


Expand Down
2 changes: 1 addition & 1 deletion src/program/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def save_speaker_availability(form, obj) -> None:
AvailabilityModel.objects.filter(**kwargs).delete()

# all the entered data is in the users local TIME_ZONE, interpret it as such
tz = ZoneInfo("Europe/Copenhagen")
tz = ZoneInfo(settings.TIME_ZONE)

# count availability form fields
fieldcounter = 0
Expand Down
3 changes: 2 additions & 1 deletion src/tokens/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from datetime import datetime

from bs4 import BeautifulSoup
from django.conf import settings
from django.urls import reverse

from tokens.models import Token
Expand All @@ -29,7 +30,7 @@ def setUpTestData(cls) -> None:
# first add users and other basics
super().setUpTestData()

tz = ZoneInfo("Europe/Copenhagen")
tz = ZoneInfo(settings.TIME_ZONE)
now = datetime.now(tz)
year = now.year

Expand Down
2 changes: 1 addition & 1 deletion src/utils/bootstrap/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
from .functions import output_fake_md_description

fake = Faker()
tz = ZoneInfo("Europe/Copenhagen")
tz = ZoneInfo(settings.TIME_ZONE)
logger = logging.getLogger(f"bornhack.{__name__}")


Expand Down
Loading