Skip to content

Commit

Permalink
Simplify has_data()
Browse files Browse the repository at this point in the history
  • Loading branch information
tkeffer committed Feb 24, 2024
1 parent d9e9f1a commit de738ca
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/weewx/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,9 @@ def exists(self):

@property
def has_data(self):
"""Check to see if there is any non-null data in the aggregation interval"""
db_manager = self.db_lookup(self.data_binding)
# First see if the type exists in the database.
if db_manager.exists(self.obs_type):
# Yes. Is it non-null?
val = bool(weewx.xtypes.get_aggregate(self.obs_type, self.timespan,
'not_null', db_manager)[0])
else:
# Nope. Try the xtypes system.
val = weewx.xtypes.has_data(self.obs_type, self.timespan, db_manager)
val = weewx.xtypes.has_data(self.obs_type, self.timespan, db_manager)
return val

def series(self, aggregate_type=None,
Expand Down

0 comments on commit de738ca

Please sign in to comment.