Files
Django_TasksApp/main
..
2026-09-30 18:01:34 +02:00
2026-09-30 18:01:34 +02:00
2026-09-30 17:25:25 +02:00
2026-09-30 17:25:25 +02:00
2026-09-30 18:01:34 +02:00

Tasknest development notes

Weather scheduling

The server gets a finite 16-day daily forecast from Open-Meteo and caches each user's normalized forecast for twelve hours. No browser code, template, or model calls Open-Meteo directly.

  • Dry rejects a day with precipitation probability of 40% or more, or 0.5 mm or more precipitation.
  • Sunny / mostly sunny also requires a clear/partly-cloudy condition and at least four hours of sunshine.
  • Warm requires a maximum temperature of at least 15 °C.
  • Dry and warm requires both of the corresponding rules.

If no forecast is available, a weather-dependent task remains visible rather than being treated as unsuitable. If a forecast finds an unsuitable natural occurrence, Tasknest creates a weather-owned occurrence shift to the first suitable vacancy in the finite forecast horizon. Natural recurrences and existing weather shifts are skipped, so an occurrence is never duplicated. The original recurrence anchor is not changed.

Deferral precedence is: manual, missed, and Sick Day state are evaluated before weather movement. Weather never overwrites those sources. Weather shifts are stored separately in TaskWeatherShift, so they can be recalculated without modifying user-owned deferrals.

Legacy ownership migration

Migration 0006 assigns old unowned tasks only when the database has exactly one active user. This local development database met that condition and its two existing tasks were assigned to that account. In a multi-user deployment the migration deliberately leaves legacy rows unowned instead of guessing; claim them explicitly before making ownership non-null at the database level.

Demo account reset

Create or reset the public demonstration account and its dummy data with:

/home/jorenmartijn/django/tasksnest/bin/python /home/jorenmartijn/django/main/manage.py seed_demo

The command resets only the demo account (default password: demo). It creates sample parent/subtasks, workouts, pain and sleep check-ins, and a 16-hour fasting schedule. It is idempotent: running it again removes demo-only edits and restores the same baseline. Use --username and --password to override the credentials.

A daily systemd timer template is provided in main/deploy/systemd/. Adjust the User, WorkingDirectory, and ExecStart paths in the service file if needed, then install it with:

sudo cp main/deploy/systemd/tasknest-demo-seed.service /etc/systemd/system/
sudo cp main/deploy/systemd/tasknest-demo-seed.timer /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now tasknest-demo-seed.timer
systemctl list-timers tasknest-demo-seed.timer

The supplied timer runs daily at 03:15 Europe/Amsterdam and catches up after a missed scheduled run when the host comes back online.