Skip to content

Commit

Permalink
errorSummary | fix if no jobs found & user dash
Browse files Browse the repository at this point in the history
  • Loading branch information
tkorchug committed Nov 25, 2024
1 parent d2428a7 commit bf0cc0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions core/libs/exlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ def calc_freq_time_series(timestamp_list, n_bins_max=60):
:param n_bins_max:
:return: freq: str - for data frame grouping
"""
if len(timestamp_list) == 0:
return '10T'
full_timerange_seconds = (max(timestamp_list) - min(timestamp_list)).total_seconds()

step = 30
Expand Down Expand Up @@ -448,13 +450,13 @@ def build_stack_histogram(data_raw, **kwargs):
# calc x-axis ticks, get average from each range
x_axis_ticks = ['x']
ranges_all_avg = np.convolve(ranges_all, np.ones(2), 'valid') / 2
x_axis_ticks.extend(list(np.round(ranges_all_avg, n_decimals)))
x_axis_ticks.extend([round_to_n_digits(r, n_decimals) for r in list(ranges_all_avg)])

ranges_all = list(ranges_all)

for stack_param, data in data_raw.items():
column = [stack_param]
column.extend(list(np.histogram(data, ranges_all)[0]))
column.extend([int(r) for r in list(np.histogram(data, ranges_all)[0])])
# do not add if all the values are zeros
if sum(column[1:]) > 0:
columns.append(column)
Expand Down
2 changes: 1 addition & 1 deletion core/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def test_api_errors_no_fields_specified(self):
response = self.client.get('/errors/?json=1&limit=10&' + self.timestamp_str)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertIsInstance(data, list)
self.assertIsInstance(data, dict)

# files
def test_files(self):
Expand Down

0 comments on commit bf0cc0c

Please sign in to comment.