Skip to content

Plantings: establishment method (direct sow / transplant / bought plants)#94

Merged
guycorbaz merged 1 commit into
mainfrom
feat/establishment-methods
Jun 9, 2026
Merged

Plantings: establishment method (direct sow / transplant / bought plants)#94
guycorbaz merged 1 commit into
mainfrom
feat/establishment-methods

Conversation

@guycorbaz

Copy link
Copy Markdown
Owner

Pre-prod feedback: Pomone only created annual plantings "from sowing", generating wrong tasks (e.g. a Repiquage on a bought apple tree — partially patched in #93). Model the three Qrop-style establishment methods, chosen per planting.

Method Schedule (Cycle) Auto tasks
Semis direct sur place sown only Semis + Récolte
Semis puis repiquage sown + transplant (DTT) Semis + Repiquage + Récolte
Plants achetés planting date only Plantation + Récolte
Pluriannuelle (arbre) establishment Plantation

Approach

  • The method is not a stored column — it's encoded by which Cycle dates are set, and the auto-generator reads it back. Reuses the existing infer_cycle_from_sowing / infer_cycle_from_transplant.
  • App: EstablishmentMethod + unified create_annual_planting(method, date, …); create_annual_planting_from_sowing kept as a Raised wrapper.
  • Auto-gen Trigger distinguishes Repiquage (raised) vs Plantation (bought/perennial). Perennials now get a Plantation task (supersedes Tasks: no auto Repiquage at perennial establishment #93's no-task).
  • A "Plantation" task type under the existing Transplant category — no migration (SQLite's category CHECK can't gain a value without an unsafe rebuild of the referenced task_type table). seed_defaults backfills it on already-seeded DBs; auto-gen picks it by name with a fallback.
  • UI: an establishment-method selector on the annual planting form; the date field becomes a sowing date (direct/raised) or planting date (bought). i18n fr/en.

Verification

  • cargo test --workspace (158), cargo clippy --workspace --all-targets, cargo fmt --check — green.
  • New tests: phase_dates (sow/transplant/plant/harvest), services (direct → Sow+Harvest, bought → Plantation+Harvest, perennial → Plantation), seed count.
  • pomone-cli seed-demo: the apple now gets a Plantation task (no Repiquage).

Follow-up CR possible: promote "Plantation" to a first-class task category once a safe task_type rebuild migration exists.

🤖 Generated with Claude Code

…nts)

Qrop models three ways to start a crop; Pomone only did "from sowing", which
generated wrong tasks (e.g. Repiquage on a bought tree). Add the method as a
per-planting choice that drives the inferred dates and the auto-tasks.

- App: `EstablishmentMethod { DirectSow, RaisedTransplant, BoughtPlants }` +
  unified `create_annual_planting(method, date, …)`. The method is encoded by
  which Cycle dates are set (no new column): direct = sown only; raised =
  sown+transplant (via DTT); bought = transplant date only, no sow. Reuses the
  existing `infer_cycle_from_sowing` / `infer_cycle_from_transplant`.
  `create_annual_planting_from_sowing` kept as a thin Raised wrapper.
- Task auto-gen: a richer `Trigger` distinguishes Repiquage (raised) from
  Plantation (bought / perennial). Perennials now get a "Plantation" task at
  establishment (supersedes the no-task behaviour of #93).
- Seed: a "Plantation" task type (Transplant category, no migration — SQLite
  CHECK can't gain a value without an unsafe rebuild). Additive backfill in
  `seed_defaults` for already-seeded DBs. Auto-gen picks it by name with a
  fallback.
- UI: an "Établissement method" selector on the annual planting form; the date
  field is a sowing date (direct/raised) or a planting date (bought). i18n
  fr/en for the method labels.

Tests: phase_dates (sow/transplant/plant/harvest cases), services (direct →
Sow+Harvest, bought → Plantation+Harvest, perennial → Plantation), seed count.
Workspace green (cargo test/clippy/fmt). Verified on seed-demo: the apple gets
a Plantation task.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@guycorbaz guycorbaz merged commit f392b81 into main Jun 9, 2026
5 checks passed
@guycorbaz guycorbaz deleted the feat/establishment-methods branch June 9, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant