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.

Command icon 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

codeitwisely created an issue. See original summary.

  • 68ca4b2e committed on 1.0.x
    Issue #3613069 by codeitwisely: Break up AiMeteringController's...
codeitwisely’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.