Konrad du Plessis e797a71b94 fix(dashboard,report): timezone.localdate + off-by-one date windows
Two related foot-guns on the admin dashboard and payroll dashboard:

1. Every `timezone.now().date()` call returned the date in UTC, not
   in Africa/Johannesburg. Between 22:00 and midnight SAST that's the
   NEXT calendar day — so the "today" the dashboard thought it was
   could be ahead of what the user sees on the clock. Now uses
   `timezone.localdate()` which respects `settings.TIME_ZONE`.
   Same fix for `datetime.date.today()` calls — those used the
   server's system clock, which on the production VM is set to UTC.

2. "Absences (last 7 days)" and "Paid (Last 60 Days)" both subtracted
   the FULL window length and combined it with `>=`, producing N+1
   inclusive days. E.g. `today - timedelta(days=7)` with `date__gte`
   spans 8 calendar days, not 7. Now subtract N-1 so the windows are
   exactly N days. Regression test: DateWindowOffByOneTests.

Findings 12 + 13.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 01:59:12 +02:00
2026-02-22 12:14:54 +00:00
2026-02-22 12:14:54 +00:00
2026-02-22 12:14:54 +00:00
2026-02-22 12:14:54 +00:00
2026-02-22 12:14:54 +00:00
2026-02-22 12:14:54 +00:00
2026-02-22 12:14:54 +00:00
2026-02-22 12:14:54 +00:00

Flatlogic Python Template Workspace

This workspace houses the Django application scaffold used for Python-based templates.

Requirements

  • Python 3.11+
  • MariaDB (or MySQL-compatible server) with the credentials prepared by setup_mariadb_project.sh
  • System packages: pkg-config, libmariadb-dev (already installed on golden images)

Getting Started

python3 -m pip install --break-system-packages -r requirements.txt
python3 manage.py migrate
python3 manage.py runserver 0.0.0.0:8000

Environment variables are loaded from ../.env (the executor root). See .env.example if you need to populate values manually.

Project Structure

  • config/ Django project settings, URLs, WSGI entrypoint.
  • core/ Default app with a basic health-check route.
  • manage.py Django management entrypoint.

Next Steps

  • Create additional apps and views according to the generated project requirements.
  • Configure serving via Apache + mod_wsgi or gunicorn (instructions to be added).
  • Run python3 manage.py collectstatic before serving through Apache.
Description
No description provided
Readme 7.6 MiB
Languages
JavaScript 42.5%
SCSS 41.7%
CSS 11.9%
Python 3.2%
HTML 0.6%