fix(gaeb): serialize position type, qty splits & long text on write - #26
Merged
Conversation
A €50,000 bid could export as €121,000. _add_item never serialized Item.item_type, so every Bedarfs-/Alternativ-/Zuschlags-/Textposition was written as a Normalposition and its price silently joined the sum on re-read. The parser had the mirror defect: _detect_item_type recognised only pyGAEB-internal names that no real GAEB exporter emits, so a genuine tender's <Provis> Bedarfspositionen were already mis-read as Normal on import. Fixes (all in the _add_item write path + _detect_item_type read path): - item_type now serialized. Writer emits the real GAEB marker (<Provis> for Bedarfs-/Eventualposition, <LumpSumItem> for Pauschalposition); non-standard types use a pyGAEB-internal marker WITH a warning that it is not yet interoperable. Blast radius covered X84 bid, X86 contract, X83 tender issue. - Parser reads the real tgItem markers (<Provis>, <LumpSumItem>, …) in addition to the legacy synthetic forms. Parser and writer now share one mapping table (pygaeb/models/position_types.py) so they cannot drift again. - qty_splits (QtySplit) now round-trip instead of being dropped on write. - Long text no longer compounds: the parser stores inner content only (was storing the wrapping <LongText> tag, which the writer then re-wrapped, nesting a layer deeper each round trip) and the writer falls back to plain_text so plaintext long texts are no longer dropped. Canonical element names pinned against the official GAEB tgItem schema + Fachdokumentation 3.3 (see docs/reference/position-types.md). New field-level round-trip tests assert per-item item_type, sum inclusion, qty_splits, and long-text stability — the old round-trip test asserted only item count and passed while all four defects fired.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
A €50,000 bid could export as €121,000. _add_item never serialized Item.item_type, so every Bedarfs-/Alternativ-/Zuschlags-/Textposition was written as a Normalposition and its price silently joined the sum on re-read. The parser had the mirror defect: _detect_item_type recognised only pyGAEB-internal names that no real GAEB exporter emits, so a genuine tender's Bedarfspositionen were already mis-read as Normal on import.
Fixes (all in the _add_item write path + _detect_item_type read path):
Canonical element names pinned against the official GAEB tgItem schema + Fachdokumentation 3.3 (see docs/reference/position-types.md). New field-level round-trip tests assert per-item item_type, sum inclusion, qty_splits, and long-text stability — the old round-trip test asserted only item count and passed while all four defects fired.