feat(plantare): tie the propose form to a real seed
The propose sheet used a free-text seed name, unlinked from the inventory. Now the seed is picked from your catalogued varieties so the Plantaré is always tied to a real Variety (tap-through to its detail, and it shows in that seed's commitments): - Seed field is an Autocomplete over the inventory; on send the typed name resolves to the matching Variety, or creates a quick one if it's new — so varietyId is never null. Sheet takes the VarietyRepository; chat passes it. - New repo one-shot `varietyLabels()` (id + label, no joins) feeds the picker. Deliberately a Future, not `watchInventory()` — a transient sheet must not hold a live Drift subscription (that hung the widget test ~36 min). Tests use it too and now run in ~2s with bounded pumps + a tall surface, no pumpAndSettle. Tests: a new name creates & links a Variety; a matching name links the existing one without duplicating. ui/services/data plantare suites green.
This commit is contained in:
parent
4ab146b157
commit
7a82505a4e
4 changed files with 185 additions and 41 deletions
|
|
@ -619,6 +619,20 @@ class VarietyRepository {
|
|||
);
|
||||
}
|
||||
|
||||
/// One-shot list of catalogued (named, non-draft) seeds for pickers — id +
|
||||
/// label only, no photo/species joins. A Future (not a stream) so a transient
|
||||
/// sheet doesn't hold a live subscription (which would hang widget tests).
|
||||
Future<List<({String id, String label})>> varietyLabels() async {
|
||||
final rows = await (_db.select(_db.varieties)
|
||||
..where((v) => v.isDeleted.equals(false) & v.isDraft.equals(false))
|
||||
..orderBy([(v) => OrderingTerm(expression: v.label)]))
|
||||
.get();
|
||||
return [
|
||||
for (final v in rows)
|
||||
if (v.label.trim().isNotEmpty) (id: v.id, label: v.label),
|
||||
];
|
||||
}
|
||||
|
||||
Future<List<VarietyListItem>> _loadInventory() async {
|
||||
final rows =
|
||||
await (_db.select(_db.varieties)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue