spine-tools / Spine-Database-API

Database interface to Spine generic data model
https://www.tools-for-energy-system-modelling.org/
GNU Lesser General Public License v3.0
6 stars 5 forks source link

Fix importing scenario alternatives out-of-order #302

Closed soininen closed 11 months ago

soininen commented 11 months ago

This PR fixes cases where before alternatives were not introduced in order in the import data, e.g.

import_scenario_alternatives(
    self._db_map, [('A', 'c', 'd'), ('A', 'd', None), ('A', 'Base', 'b'), ('A', 'b', 'c')]
)

now correctly orders the alternatives as Base, b, c, d whereas before this fix, the order was b, c, d, Base

Fixes spine-tools/Spine-Toolbox#2374

Checklist before merging

codecov-commenter commented 11 months ago

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (7cac90d) 75.35% compared to head (ab2bd9e) 75.35%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #302 +/- ## ======================================= Coverage 75.35% 75.35% ======================================= Files 76 76 Lines 10953 10978 +25 Branches 2379 2390 +11 ======================================= + Hits 8254 8273 +19 - Misses 2259 2267 +8 + Partials 440 438 -2 ``` | [Files](https://app.codecov.io/gh/spine-tools/Spine-Database-API/pull/302?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spine-tools) | Coverage Δ | | |---|---|---| | [spinedb\_api/helpers.py](https://app.codecov.io/gh/spine-tools/Spine-Database-API/pull/302?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spine-tools#diff-c3BpbmVkYl9hcGkvaGVscGVycy5weQ==) | `58.07% <ø> (ø)` | | | [spinedb\_api/import\_functions.py](https://app.codecov.io/gh/spine-tools/Spine-Database-API/pull/302?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spine-tools#diff-c3BpbmVkYl9hcGkvaW1wb3J0X2Z1bmN0aW9ucy5weQ==) | `87.50% <73.33%> (-0.33%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.