Skip to content

Commit

Permalink
refactor: move up check start of method
Browse files Browse the repository at this point in the history
Signed-off-by: F.N. Claessen <[email protected]>
  • Loading branch information
Flix6x committed Jul 17, 2024
1 parent 300a667 commit 9414484
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions timely_beliefs/beliefs/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ def add_to_session(
if False, you can still add other data to the session
and commit it all within an atomic transaction
"""
if beliefs_data_frame.empty:
return
# Belief timing is stored as the belief horizon rather than as the belief time
beliefs_data_frame = (
beliefs_data_frame.convert_index_from_belief_time_to_horizon().reset_index()
Expand All @@ -295,9 +297,6 @@ def add_to_session(
beliefs_data_frame["sensor_id"] = beliefs_data_frame.sensor.id
beliefs_data_frame = beliefs_data_frame.drop(columns=["source"])

if len(beliefs_data_frame) == 0:
return

smt = insert(cls).values(beliefs_data_frame.to_dict("records"))

if allow_overwrite:
Expand Down

0 comments on commit 9414484

Please sign in to comment.