Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MVarshini committed Dec 9, 2024
1 parent 065e2ba commit b2642d4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
6 changes: 4 additions & 2 deletions backend/app/api/v1/commons/hce.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ async def getData(start_datetime: date, end_datetime: date, size: int, offset: i
await es.close()
tasks = [item['_source'] for item in response['data']]
jobs = pd.json_normalize(tasks)
if len(jobs) == 0:
return({'data':jobs, 'total': response['total']})

jobs[['group']] = jobs[['group']].fillna(0)
jobs.fillna('', inplace=True)
if len(jobs) == 0:
return({'data':jobs, 'total': 0})

return ({'data':jobs, 'total': response['total']})
2 changes: 1 addition & 1 deletion backend/app/api/v1/commons/ocm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def getData(start_datetime: date, end_datetime: date, size:int, offset:int
tasks = [item['_source'] for item in response['data']]
jobs = pd.json_normalize(tasks)
if len(jobs) == 0:
return {"data":jobs,"total": 0}
return {"data":jobs,"total": response["total"]}

if 'buildUrl' not in jobs.columns:
jobs.insert(len(jobs.columns), "buildUrl", "")
Expand Down
3 changes: 2 additions & 1 deletion backend/app/api/v1/commons/ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ async def getData(start_datetime: date, end_datetime: date, size:int, offset:int
tasks = [item['_source'] for item in response["data"]]
jobs = pd.json_normalize(tasks)
if len(jobs) == 0:
return ({'data':jbs, 'total': 0})
return ({'data':jobs, 'total': response['total']})

jobs[['masterNodesCount', 'workerNodesCount',
'infraNodesCount', 'totalNodesCount']] = jobs[['masterNodesCount', 'workerNodesCount', 'infraNodesCount', 'totalNodesCount']].fillna(0)
jobs.fillna('', inplace=True)
Expand Down
2 changes: 1 addition & 1 deletion backend/app/api/v1/commons/quay.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def getData(start_datetime: date, end_datetime: date, size, offset, config
tasks = [item['_source'] for item in response['data']]
jobs = pd.json_normalize(tasks)
if len(jobs) == 0:
return ({'data':jbs, 'total': 0})
return ({'data':jobs, 'total': response['total']})

jobs[['masterNodesCount', 'workerNodesCount',
'infraNodesCount', 'totalNodesCount']] = jobs[['masterNodesCount', 'workerNodesCount', 'infraNodesCount', 'totalNodesCount']].fillna(0)
Expand Down
4 changes: 1 addition & 3 deletions backend/app/api/v1/commons/telco.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,5 @@ async def getData(start_datetime: date, end_datetime: date, size: int, offset: i
})

jobs = pd.json_normalize(mapped_list)
if len(jobs) == 0:
return {'data':jobs, 'total': 0}

return {'data':jobs, 'total':response['total']}
return {'data':jobs, 'total': response['total']}

0 comments on commit b2642d4

Please sign in to comment.