Skip to content

Commit

Permalink
fix: handle empty cached results
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Nov 4, 2023
1 parent 1d7b482 commit dca18f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions insights/insights/doctype/insights_query/insights_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def results(self):

@property
def results_row_count(self):
return len(CachedResults.get(self.name))
return len(self.retrieve_results())

@cached_property
def variant_controller(self):
Expand Down Expand Up @@ -154,7 +154,7 @@ def retrieve_results(self, fetch_if_not_cached=False):
if fetch_if_not_cached:
return self.fetch_results()
return []
return CachedResults.get(self.name)
return CachedResults.get(self.name) or []

def fetch_results(self, additional_filters=None):
self.before_fetch()
Expand Down

0 comments on commit dca18f3

Please sign in to comment.