Skip to content

fix missing key in chargelog calculation#3343

Open
LKuemmel wants to merge 4 commits intomasterfrom
fix_energy_mix
Open

fix missing key in chargelog calculation#3343
LKuemmel wants to merge 4 commits intomasterfrom
fix_energy_mix

Conversation

@LKuemmel
Copy link
Copy Markdown
Contributor

@LKuemmel LKuemmel commented May 4, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the “energy imported by source” calculation to avoid missing-key failures (notably in charge log processing) by consolidating the per-CP and “all” variants into a single function and making name lookups more tolerant.

Changes:

  • Replaced the split calc_energy_imported_by_source_all / calc_energy_imported_by_source_cp logic with a unified calc_energy_imported_by_source(...).
  • Adjusted _analyse_energy_source to use the unified function and to optionally filter which error messages are emitted.
  • Updated unit tests to import and call the renamed function.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
packages/helpermodules/measurement_logging/process_log.py Consolidates energy-source import calculation and adds message filtering to prevent missing-key crashes in charge log flows.
packages/helpermodules/measurement_logging/process_log_unit_test.py Updates imports/test name to use the unified calculation function.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/helpermodules/measurement_logging/process_log.py Outdated
Comment thread packages/helpermodules/measurement_logging/process_log.py Outdated
Comment thread packages/helpermodules/measurement_logging/process_log.py Outdated
Comment thread packages/helpermodules/measurement_logging/process_log_unit_test.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/helpermodules/measurement_logging/process_log.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LKuemmel LKuemmel marked this pull request as ready for review May 5, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants