Skip to content

fix(farmer_demo): assign FARM group type to farm demo data (#1120)#322

Open
emjay0921 wants to merge 1 commit into
19.0from
fix/1120-farm-group-type
Open

fix(farmer_demo): assign FARM group type to farm demo data (#1120)#322
emjay0921 wants to merge 1 commit into
19.0from
fix/1120-farm-group-type

Conversation

@emjay0921

Copy link
Copy Markdown
Contributor

Why is this change needed?

The farmer demo data generator created farm groups with a blank Group Type (OP#1120). Farm groups should default to Farm, and cooperative container groups to Cooperative. Neither generator set group_type_id, and no farm code existed in the urn:openspp:vocab:group-type vocabulary (only cooperative was created at runtime).

How was the change implemented?

  • Added _ensure_farm_group_type() (mirrors the existing _ensure_cooperative_group_type()) to create a local farm group-type code via get_or_create_local — in both the story-farm wizard and the seeded-farm utility.
  • Set group_type_id = farm on every farm group created by both generators (story farms in _create_farm, and the ~730 seeded/volume farms).
  • Cooperative container groups keep group_type_id = cooperative; member farms stay Farm (a farm is still a farm inside a cooperative — only the container is a Cooperative).

New unit tests

  • test_1120_cooperative_container_typed_cooperative — the cooperative container is typed cooperative and its member farms are typed farm.
  • Added group_type_id.code == "farm" assertions to the seeded-farm generator test, the story-farm group test, and the _create_farm helper test.

Unit tests executed by the author

spp_farmer_registry_demo suite: 0 failed, 0 error(s) of 133 tests (fresh DB, --stop-after-init).

How to test manually

  1. Run the farmer demo data generator (with cooperatives enabled).
  2. Registry → Groups: open any farm group → Group Type = Farm; open a cooperative (e.g. Nueva Ecija Rice Cooperative) → Group Type = Cooperative.
  3. Confirm no farm group has a blank Group Type, and that cooperative member farms are still typed Farm.

Related links

https://projects.acn.fr/work_packages/1120

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.91304% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.11%. Comparing base (1caf794) to head (cf17b9e).
⚠️ Report is 3 commits behind head on 19.0.

Files with missing lines Patch % Lines
...rmer_registry_demo/models/farmer_demo_generator.py 70.00% 3 Missing ⚠️
...rmer_registry_demo/models/seeded_farm_generator.py 76.92% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #322      +/-   ##
==========================================
- Coverage   74.28%   67.11%   -7.17%     
==========================================
  Files         372      100     -272     
  Lines       25385     9817   -15568     
==========================================
- Hits        18857     6589   -12268     
+ Misses       6528     3228    -3300     
Flag Coverage Δ
spp_analytics ?
spp_api_v2_cycles ?
spp_api_v2_entitlements ?
spp_api_v2_gis ?
spp_api_v2_programs ?
spp_api_v2_simulation ?
spp_audit_programs ?
spp_base_common 91.07% <ø> (+0.80%) ⬆️
spp_case_demo ?
spp_case_entitlements ?
spp_case_programs ?
spp_cr_type_assign_program ?
spp_dci_compliance ?
spp_dci_demo ?
spp_dci_server_social ?
spp_demo ?
spp_demo_phl_luzon ?
spp_drims ?
spp_drims_sl ?
spp_drims_sl_demo ?
spp_farmer_registry_demo 63.38% <73.91%> (+2.36%) ⬆️
spp_gis_report ?
spp_grm_demo ?
spp_indicator ?
spp_indicator_studio ?
spp_metric_service ?
spp_mis_demo_v2 ?
spp_programs 65.27% <ø> (+<0.01%) ⬆️
spp_registry 86.94% <ø> (+0.10%) ⬆️
spp_security 69.56% <ø> (+2.89%) ⬆️
spp_simulation ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rmer_registry_demo/models/farmer_demo_generator.py 53.51% <70.00%> (+3.36%) ⬆️
...rmer_registry_demo/models/seeded_farm_generator.py 82.07% <76.92%> (-0.16%) ⬇️

... and 272 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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