Skip to content

Commit cd964f1

Browse files
authored
fix wrong return in get_timeseries_metadata_from_timeseries_collection (#142)
* fix wrong return in get_timeseries_metadata_from_timeseries_collection * bump to 0.5.15
1 parent f95ac8b commit cd964f1

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 0.5.15
4+
🐛 Bug Fixes
5+
* fix wrong return in get_timeseries_metadata_from_timeseries_collection by @jthurner in https://github.com/e2nIEE/pandahub/pull/142
6+
37
## 0.5.14
48
🛠 Improvements
59
* allow ignoring the user lock when activating a project

pandahub/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.5.14"
1+
__version__ = "0.5.15"
22

33
from pandahub.lib.PandaHub import PandaHub, PandaHubError, PandaPowerNet, PandaPipesNet, PandaNet, SettingsValue, ProjectID
44

pandahub/lib/PandaHub.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,16 +2510,18 @@ def get_timeseries_metadata(
25102510
del df_metadata["return_id"]
25112511
return df_metadata
25122512

2513-
2514-
def get_timeseries_metadata_from_metadata_collection(self, filter_document, metadata_collection_name, timestamp_range=None):
2513+
def get_timeseries_metadata_from_metadata_collection(
2514+
self, filter_document: dict, metadata_collection_name: str, timestamp_range=None
2515+
) -> list[dict]:
25152516
db = self._get_project_database()
25162517
if timestamp_range is not None:
25172518
filter_document["first_timestamp"] = {"$lte": timestamp_range[1]}
25182519
filter_document["last_timestamp"] = {"$gte": timestamp_range[0]}
25192520
return db[metadata_collection_name].find(filter_document).to_list()
25202521

2521-
2522-
def get_timeseries_metadata_from_timeseries_collection(self, filter_document, collection_name, timestamp_range=None):
2522+
def get_timeseries_metadata_from_timeseries_collection(
2523+
self, filter_document: dict, collection_name: str, timestamp_range=None
2524+
) -> list[dict]:
25232525
db = self._get_project_database()
25242526
pipeline = []
25252527
if len(filter_document) > 0:
@@ -2538,7 +2540,7 @@ def get_timeseries_metadata_from_timeseries_collection(self, filter_document, co
25382540
document_filter, projection={"timestamp": 0, "_id": 0}
25392541
)
25402542
if document is None:
2541-
return pd.DataFrame()
2543+
return []
25422544
value_fields = ["$%s" % field for field in document.keys() if field != "metadata"]
25432545
group_dict = {
25442546
"_id": "$metadata._id",

0 commit comments

Comments
 (0)