Commit Graph
3 Commits
Author SHA1 Message Date
Esa Kataja d743327cd2 Add Tähteet, and the real household dish list
Tähteet is leftovers. It is not food: it exists so a day can be recorded as
"we ate what was already there" without inventing a meal nobody cooked.

Modelled as a row flagged `special` rather than a nullable main_dish_id on
the log, so every foreign key and join carries on working. Migration 0002
creates it; the household never adds, edits or deletes it, and it never
appears in the catalog. It is loggable exactly like a real meal and sits on
the board apart from the categories, muted and at fixed size — it will be
among the most-logged entries and should not tower over the actual cooking.

It carries no category, which is why it could not be an ordinary main: those
must have at least one. That also exposed a bug in CategoryKey, which
returned the mixed Sekalaiset mark for anything that was not exactly one
category — so *no* categories drew the same icon as *several*. Zero now means
not food and gets its own mark, a lidded tub in grey rather than a category
colour. The fix reaches the board, the sides step, the logged card and the
history at once, since they all ask the same function.

PRD §6 records the hard requirement: the stage 2 suggester must never propose
it, so cooldown, coverage and weighting all skip it despite how often it is
logged.

The seed bundle is now the household's real list, taken from a JSON file
written in December 2024: 37 mains and 9 sides. Letut and Pannari were
dropped as not being dinners, Kanakintut folded into Broilerin koipireidet,
and has_sides assigned by rule — soups, casseroles, laatikko, kiusaus,
risotto and pasta dishes take none; sauces, patties and roasts do.

Two tests failed immediately on the migration because they hardcoded id 1,
which the new row now occupies. Moved clear of it.
2026-09-05 23:11:58 +03:00
Esa Kataja d95b9f9f91 Add Lohkoperunat to the household bundle 2026-09-05 18:32:11 +03:00
Esa Kataja c9a63bdd9e Scaffold the Go app: auth, migrations, bundle import
Bring up the stage 1 skeleton described in the PRD, enough that the app
builds, serves, and can be populated with dishes.

- net/http server with shared-password Basic auth, /healthz outside it,
  graceful shutdown, and TZ-aware calendar days
- SQLite via modernc (pure Go, static binary), opened with WAL and a single
  connection
- migration runner: numbered SQL files embedded and applied once each inside
  a transaction, recorded in schema_migrations
- bundle import (PRD §7.3) as a live feature on the Ruoat tab: paste JSON or
  upload a file, get a per-row Finnish report. The same importer is reachable
  as `foodster -import` for repopulating a scratch database
- templ views and hand-written CSS with light-dark() theming; the Datastar
  v1.0.3 client is vendored, since the Go SDK ships no browser asset and a
  CDN would break an offline LAN

Names are normalized to sentence case rather than title case: Finnish
capitalizes only the first word of a phrase, so "Keitetyt perunat" is right
and "Keitetyt Perunat" is not. PRD §6 and §7.3 are amended to match.

Testing is behind make targets rather than ad-hoc commands: `make check` runs
lint, unit tests and scripts/smoke.sh, which exercises auth, static assets
and every import path against a scratch database on a spare port.
2026-09-05 18:15:17 +03:00