Problem/Motivation
AiMeteringController has grown past a maintainable size. dashboard() builds month/year resolution, per-row action dropbuttons, chart data assembly, and totals formatting all in one method, and exportLogJson() has grown deeply nested branching for column selection and value formatting. Each new field, export format, or filter option added to the dashboard makes the class harder to follow and safely change.
Proposed resolution
Extract dashboard()'s distinct responsibilities (month/year resolution, per-row dropbutton construction, chart data assembly, totals formatting) into focused private methods or a small value-building helper, and break exportLogJson()'s branching into smaller, single-purpose methods. No behavior change. This is a structural refactor covered by the module's existing functional and kernel tests, which must keep passing unmodified as the acceptance bar.
AI assistance
Yes.
Issue fork ai_metering-3613069
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
codeitwisely commented