Skip to content

fix: do not suggest joining the parent's group to an asset that has joined it - #2959

Merged
Flix6x merged 3 commits into
mainfrom
fix/group-hint-when-already-grouped
Dec 5, 2026
Merged

Flix6x merged 3 commits into
mainfrom
fix/group-hint-when-already-grouped

Conversation

@Flix6x

@Flix6x Flix6x commented Dec 4, 2026

Copy link
Copy Markdown
Member

Description

An asset's properties page shows a hint in its flex-model editor when the parent asset defines a power-capacity:
"Consider setting group: {"asset": <parent id>} so this device counts toward the parent's limit."

It showed that hint also on assets whose flex-model already sets group to that parent, which suggests to the user that something is missing when the setup is complete.
The view now leaves the hint out when the asset's group already references its parent.

  • Fix in flexmeasures/ui/views/assets/views.py
  • Extended test_group_field_hints_on_properties_page with a child that has joined its parent's group (fails without the fix)
  • Changelog entry (Bugfixes)

How to test

pytest flexmeasures/ui/tests/test_asset_crud.py -k group_field_hints

Or in the UI: give a parent asset a flex-model with power-capacity, give a child asset a flex-model with "group": {"asset": <parent id>}, and open the child's properties page: no hint to set group. A child without group still gets the hint.

Related Items

Found while configuring transformers (with a power-capacity) and the devices behind them as groups.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DWv6v43ZLVBreH3X7JVufb

Flix6x and others added 2 commits December 4, 2026 16:47
…oined it

The properties page hinted that an asset should set `group` to its parent whenever the parent defines a power-capacity,
also when the asset's flex-model already references the parent as its group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DWv6v43ZLVBreH3X7JVufb
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DWv6v43ZLVBreH3X7JVufb
Signed-off-by: F.N. Claessen <claessen@seita.nl>
@Flix6x Flix6x added this to the 1.2.0 milestone Dec 4, 2026
@Flix6x Flix6x added bug Something isn't working UI labels Dec 4, 2026
@Flix6x Flix6x self-assigned this Dec 4, 2026
@read-the-docs-community

read-the-docs-community Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

📖 2 files modified


Preview · build overview · flexmeasures · built Dec. 5, 2026, 10:51 a.m. UTC

…its parent's group

Keep parent_has_power_capacity a fact about the parent and pass joined_parent_group on its own,
so the group field's info panel no longer drops the parent's power-capacity for a grouped child,
and says the device is in the parent's group (without the 'use parent as group' button).
It reads the group as it stands in the editor. A group id written as a string counts too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: F.N. Claessen <claessen@seita.nl>

@Flix6x Flix6x left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review. The alert is gone on a child whose group is its parent, and the test covers it (it fails without the fix). A nice side effect: a grouped child that has its own power-capacity and children (a transformer under a site) now gets the "Child assets can reference this asset as their group" hint, which the old alert used to hide.

One thing the PR missed: parent_has_power_capacity also feeds the page's JS, in the group field's own info panel. On a grouped child that panel now drops the parent's power-capacity and says "Consider using the parent asset … as the group", with the "Use parent asset … as group" button: still a suggestion to do what is done.

I'm pushing a fix to this branch: parent_has_power_capacity stays a fact about the parent and joined_parent_group goes to the template on its own. The panel reads the group as it stands in the editor and says "This device's group is the parent asset …, so it counts toward the parent's power-capacity", without the button. Ids are compared as strings, so a group stored as {"asset": "5"} counts too. The test also checks the page still tells its JS the parent has a power-capacity.

@Flix6x

Flix6x commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

Follow-ups of the review:

  • push-fix: pushed review/2959-fix to this branch as a fast-forward, 49b05db0a: the group field's info panel now also knows the asset joined its parent's group (no "Use parent asset … as group" button, group read from the editor, string ids count), and parent_has_power_capacity stays a fact about the parent. test_asset_crud.py passes (52 tests); the added assertion fails without the change. All 11 CI checks are green.

@Flix6x
Flix6x merged commit fb9a467 into main Dec 5, 2026
11 checks passed
@Flix6x
Flix6x deleted the fix/group-hint-when-already-grouped branch December 5, 2026 11:02
Flix6x added a commit that referenced this pull request Dec 5, 2026
Keep both sides in the changelog's New features and Bugfixes lists (this PR's
entries and main's #2713 and #2959 entries); the API changelog entry stays in
main's open section, v3.0-38, and the v1.1.0 section is there once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant