Skip to content

Remove extra holpa items - #59

Merged
dave-mills merged 4 commits into
devfrom
remove-extra-holpa-items
Jul 31, 2026
Merged

Remove extra holpa items#59
dave-mills merged 4 commits into
devfrom
remove-extra-holpa-items

Conversation

@dave-mills

Copy link
Copy Markdown
Member

Removes legacy data models and exports that use HOLPA's form structures.

Completes Phase 6 (cutover) of the ODK-Entities farm CRUD work: farms now
live only as ODK Central entities via FarmEntity/FarmEntityResource.

- move FarmListHeaderWidget and the combined-import Blade view into the
  FarmEntityResource tree (both were shared, not legacy)
- delete FarmResource + pages, App\Models\SampleFrame\Farm, FarmImport,
  FarmPolicy, FarmImportCompleted, DataCollectionByFarm and
  HelperService::findFarmLocationDetails() - all dormant or unreferenced
- purge the whole App\Models\SurveyData namespace (FarmSurveyData, Crop,
  Livestock) and the RepeatModel interface that only described it; the
  same-named exports survive, they are Dataset-name-driven not model-driven
- repoint Team::pilotProgress / dataCollectionProgress at submissions
  (the farm-derived expressions could only ever return false)
- drop Location's three farm-completion attributes and the dead
  'Farms surveyed' admin stat; keep farms_all_count (FarmEntity-backed)
- ImportFarmsAction now tags its Import record model_type => FarmEntity
- drop the farms, crops, livestocks and farm_survey_data tables
The legacy FarmResource that owned app/{tenant}/location-levels/farms is
gone, so the entities-backed resource can take the clean URL back. Class
names are unchanged; only the slug and the two tests that hit the route
by path move.
Fixes finding M13. The wizard called Excel::import() twice, and for a
ShouldQueue + WithChunkReading importer each call builds its own
QueueImport -> ReadChunk... -> AfterImportJob chain. Two independent
chains on one queue means ordering is whatever the worker pool decides,
so with more than one worker the farm chunks could run before the
location chunks had committed - and FarmEntityImport::rules() validates
its location column with Rule::exists('locations', 'code').

Bus::chain() would not fix it: a chained job calling Excel::import()
returns as soon as the chunks are queued. The dependency has to live
inside the chain maatwebsite/excel already built, so the farm import is
appended to its tail via PendingDispatch -> Queueable::appendToChain().

- new QueueFarmEntityImport job; resolves the media path from the Import
  id at run time, and its failed() surfaces a start-up failure on the
  imports table instead of leaving the record silently empty
- the farm job's payload drops $data['level'] (a LocationLevel model,
  which SerializesModels cannot reduce inside an array property)
- LocationImport now writes a 'skipped because the location import
  failed' error onto the dependent farm Import record when
  dependent_import_id is present; the key is optional for standalone use
@dave-mills
dave-mills merged commit 8b4fb2c into dev Jul 31, 2026
1 check passed
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