Chart: allow dynamic stacked - #30
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for dynamic stacking in chart graphs by allowing the grouping of data based on multiple fields including the stacked attribute. The main enhancement enables charts to process stacked data dynamically rather than relying on static field references.
- Introduces a new method
get_values_grouped_by_fieldsto group data by multiple fields simultaneously - Updates chart processing logic to handle dynamic stacked field grouping when both label and stacked fields are present
- Adds the stacked attribute as a recognized field in the fields collection
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ooui/graph/processor.py | Adds new get_values_grouped_by_fields method for multi-field grouping |
| ooui/graph/chart.py | Updates field collection and processing logic to support dynamic stacked grouping |
| spec/graph/graph_spec.py | Adds comprehensive test coverage for stacked field functionality |
Comments suppressed due to low confidence (2)
ooui/graph/processor.py:45
- The parameter name
fields_namesshould befield_namesto be consistent with the existingget_values_grouped_by_fieldfunction parameter naming.
def get_values_grouped_by_fields(fields_names, fields, values):
ooui/graph/processor.py:49
- The docstring parameter name
fields_namesshould befield_namesto match the corrected parameter name.
:param list fields_names: A list of field names by which to group values.
|
@giscebot resolt conflictes i repassa la pull-request |
Resolve the graph spec conflict while retaining both the dynamic stacked coverage and the newer indicator tests.\n\nCo-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
|
Conflictes resolts i branca actualitzada amb He conservat tant els tests de dynamic stacking com els nous tests d’indicadors de Validació:
|
giscebot
left a comment
There was a problem hiding this comment.
Hi ha un cas bloquejant abans de fusionar.
get_values_grouped_by_fields() concatena directament les etiquetes amb ' - '.join(...). get_value_and_label_for_field() retorna None per a un selection sense valor/fora de catàleg i per a un many2one buit, de manera que qualsevol registre amb el nou camp stacked no informat provoca TypeError: sequence item ... expected str instance, NoneType found i avorta tot el gràfic. L'agrupació anterior per un sol camp admetia aquests valors sense excepció.
Cal definir i preservar el tractament dels valors no informats (per exemple, normalitzant només la part de presentació a una cadena buida o a l'etiqueta corresponent, sense perdre la clau de grup) i afegir un test amb stacked=False per a un camp selection o many2one. El test ha de fallar amb la implementació actual i comprovar tant que no hi ha excepció com el resultat del grup.
He revisat el diff complet, el flux label + stacked, la interacció amb get_value_and_label_for_field() i els tests afegits. El check build és verd (144 exemples), però la suite local no s'ha pogut repetir en aquest host perquè el worktree no té instal·lades les dependències (lxml/mamba).
|
@giscebot millora el codi per tenir en compte els errors que has trobat |
|
No ho puc aplicar en aquest torn perquè el job ha arribat explícitament en mode review-only: no tinc autorització per modificar la branca, fer commit ni push. El bloqueig continua vigent al HEAD Cal rellançar aquesta petició amb permisos d'implementació perquè pugui fer el canvi, provar-lo i pujar-lo a aquesta PR. |
|
@giscebot fes tu els canvis de la pull-request segons el que has detectat al fil d'aquesta pull-request |
|
He revisat de nou el HEAD No puc aplicar els canvis des d’aquest job perquè ha estat lliurat explícitament amb Perquè ho implementi jo, cal reenviar/obrir el treball amb mode d’implementació sobre aquesta PR. El canvi esperat és normalitzar només l’etiqueta de presentació abans del |
|
@giscebot fes tu els canvis de la pull-request segons el que has detectat al fil d'aquesta pull-request |
Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
|
Canvi aplicat al commit He corregit el cas bloquejant detectat a la revisió: Validació local: 23 exemples de |
giscebot
left a comment
There was a problem hiding this comment.
Aprovat. He revisat el diff complet i, en particular, el flux de fields() → agrupació per [label, stacked] → sortida del chart, la compatibilitat amb el comportament estàtic anterior i el tractament de valors buits.
El bloqueig de la revisió anterior queda resolt al HEAD 1bfa8fd: la clau d’agrupació conserva el valor False i només es normalitza l’etiqueta de presentació abans del join; el test de regressió ho comprova explícitament. També hi ha cobertura d’integració del chart dinàmic.
Validació: el check build de GitHub és verd amb 145 exemples. No he pogut repetir la suite en aquest host perquè el worktree no té mamba ni lxml, però he contrastat el resultat del CI amb el codi i la cobertura afegida. No hi veig regressions ni canvis pendents abans de fusionar.
This pull request enhances the
ooui/graphmodule by introducing support for grouping and processing data based on multiple fields, including thestackedattribute. It also adds comprehensive tests to validate the new functionality. The most important changes are grouped below:Enhancements to Data Grouping and Processing:
get_values_grouped_by_fieldsinooui/graph/processor.pyto enable grouping values by multiple fields. This method generates keys as tuples of field values and supports creating combined labels.processmethod inooui/graph/chart.pyto handle cases where thestackedattribute is specified. It now usesget_values_grouped_by_fieldswhen grouping by bothlabelandstackedfields.fieldsmethod inooui/graph/chart.pyto include thestackedattribute as a field if it is defined.Bug Fixes and Improvements:
y_field.stackeddirectly with a dynamically determinedstackedvariable in theprocessmethod to ensure the correct value is used in all cases.Test Coverage:
spec/graph/graph_spec.pyto verify that thestackedattribute is treated as a field and that bar graphs with stacked fields are processed correctly. These tests validate the grouping logic and ensure the output matches the expected format. [1] [2]Follow-up fix
selectionfield withstacked=False.