Skip to content

COHIV-223 NK refactor: Add cost type for ZEV#326

Open
MarcoSteinacher wants to merge 4 commits intodev/COHIV-225_cost_per_rental_unitfrom
dev/COHIV-223_cost_type_ZEV
Open

COHIV-223 NK refactor: Add cost type for ZEV#326
MarcoSteinacher wants to merge 4 commits intodev/COHIV-225_cost_per_rental_unitfrom
dev/COHIV-223_cost_type_ZEV

Conversation

@MarcoSteinacher
Copy link
Copy Markdown
Member


I confirm that I have read the Contributor Agreement v1.1, agree to be bound on them and confirm that my contribution is compliant.

Marco's Agent and others added 4 commits April 13, 2026 19:30
- 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>
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.

1 participant