Skip to content

Commit

Permalink
Merge b0bda7c into 726cd32
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarcia98 committed Jun 9, 2023
2 parents 726cd32 + b0bda7c commit ded5555
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ Infrastructure / Support

.. warning:: The setting `FLEXMEASURES_PLUGIN_PATHS` has been deprecated since v0.7. It has now been sunset. Please replace it with :ref:`plugin-config`.

v0.13.2 | Jun XX, 2023
=======================
Bugfixes
---------
* Fix failing to save results of scheduling and reporting on subsequent calls for the same time period [see `PR #709 <https://github.com/FlexMeasures/flexmeasures/pull/709>`_]


v0.13.1 | May 12, 2023
=======================
Expand Down
9 changes: 9 additions & 0 deletions flexmeasures/data/models/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from sqlalchemy.ext.mutable import MutableDict
from sqlalchemy.orm import Query, Session
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy import inspect
import timely_beliefs as tb
from timely_beliefs.beliefs.probabilistic_utils import get_median_belief
import timely_beliefs.utils as tb_utils
Expand Down Expand Up @@ -584,6 +585,14 @@ def __init__(
source: tb.DBBeliefSource,
**kwargs,
):
# get a Sensor instance attached to the database session (input sensor is detached)
# check out Issue #683 for more details
inspection_obj = inspect(sensor, raiseerr=False)
if (
inspection_obj and inspection_obj.detached
): # fetch Sensor only when it is detached
sensor = Sensor.query.get(sensor.id)

tb.TimedBeliefDBMixin.__init__(self, sensor, source, **kwargs)
tb_utils.remove_class_init_kwargs(tb.TimedBeliefDBMixin, kwargs)
db.Model.__init__(self, **kwargs)
Expand Down

0 comments on commit ded5555

Please sign in to comment.