COHIV-223 NK refactor: Add cost type for ZEV#326
Open
MarcoSteinacher wants to merge 4 commits intodev/COHIV-225_cost_per_rental_unitfrom
Open
COHIV-223 NK refactor: Add cost type for ZEV#326MarcoSteinacher wants to merge 4 commits intodev/COHIV-225_cost_per_rental_unitfrom
MarcoSteinacher wants to merge 4 commits intodev/COHIV-225_cost_per_rental_unitfrom
Conversation
- Add NkCostZEVStromallmend (cost/zev.py): new NkCost subclass implementing
ZEV electricity cost calculation per rental unit, mirroring the logic of
the old report_nk.stromrechnung(). Reads measurement data from
report.object_messung[ru.name] and building totals from report.data_amount,
computes eigenverbrauch solar, netzstrom, HKN, and corrections.
- Add NkCost.get_extra_context() hook (cost/base.py): base class returns {}
by default; subclasses can override to inject extra variables into the ODT
bill template context beyond the standard billing-group fields.
- Modify NkBill._get_rental_unit_context() (bill.py): after building the
costs list, call get_extra_context() on every cost and merge the result
into the context dict, enabling NkCostZEVStromallmend to inject the
ssd_*, sss_*, snh_*, snt_*, shk_*, sk_*, st_*, stot_* variables required
by the Stromkosten section of the ODT template.
- Add tests (tests/test_nk_zev.py): three test cases covering correct
per-unit cost calculation, extra-context variable generation, and the
no-measurement-data zero case.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I confirm that I have read the Contributor Agreement v1.1, agree to be bound on them and confirm that my contribution is compliant.