assume-framework / assume

ASSUME - Agent-based Simulation for Studying and Understanding Market Evolution
https://assume.readthedocs.io
20 stars 5 forks source link

Fix double dispatch writing #332

Closed maurerle closed 4 months ago

maurerle commented 4 months ago

This fixes the issue that the dispatch is written twice in the units_operator, which @kim-mskw mentioned in one of the CSVs.

I am not sure, if this fix is correct as we changed the behavior from "write only the dispatch until before now" to "write the dispatch including now" in b1ae73e9ce9d4079df93fa3c901127f7ef59353f I think this was due to that the current_dispatch should be executed (e.g. confirmed) also for the current hour, and we had a problem if it is not there yet.

Though we might have fixed the need for including the current hour too with 0f43e135f1e08cddabae25cdf2cfdac9a4aff71c in #290 ..?

UPDATE: I found that the problem was not writing the current hour twice, but the last one - this is fixed in the last commit.

I wrote a test to make sure that this behavior is confirmed to work, though we probably need more test cases in general.

I am quite sure that this is the fix we need here.

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 77.33%. Comparing base (b8345fe) to head (f8431e9).

Files Patch % Lines
assume/common/outputs.py 0.00% 1 Missing :warning:
assume/common/units_operator.py 90.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #332 +/- ## ========================================== + Coverage 77.32% 77.33% +0.01% ========================================== Files 43 43 Lines 5009 5013 +4 ========================================== + Hits 3873 3877 +4 Misses 1136 1136 ``` | [Flag](https://app.codecov.io/gh/assume-framework/assume/pull/332/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=assume-framework) | Coverage Δ | | |---|---|---| | [pytest](https://app.codecov.io/gh/assume-framework/assume/pull/332/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=assume-framework) | `77.33% <81.81%> (+0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=assume-framework#carryforward-flags-in-the-pull-request-comment) to find out more.

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