Problem/Motivation

AiMeteringController mixes dashboard rendering with export logic (CSV, JSON, raw log JSON) in the same class. The export path has its own filtering, row building, filename building, and CSV escaping, none of which the dashboard rendering needs. Keeping both responsibilities in one controller makes the class harder to navigate and test in isolation.

Proposed resolution

Extract the export-related methods (exportCsv(), exportJson(), exportLogJson(), and their private helpers for filtering, row building, filename building, and CSV cell escaping) into a dedicated service, injected into the controller. The controller's export methods become thin wrappers that call the service and return the response. No behavior change.

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.

  • eee307eb committed on 1.0.x
    Issue #3613150 by codeitwisely: Extract export logic from...
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.

codeitwisely’s picture

Status: Fixed » Closed (fixed)