From e34d712705c73d498c98b37d587ff0d106c444de Mon Sep 17 00:00:00 2001 From: wuaho Date: Fri, 27 Aug 2021 11:28:13 +0800 Subject: [PATCH] 1 --- api/api_v1/endpoints/dashboard.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/api_v1/endpoints/dashboard.py b/api/api_v1/endpoints/dashboard.py index a38dfac..9aa7b3e 100644 --- a/api/api_v1/endpoints/dashboard.py +++ b/api/api_v1/endpoints/dashboard.py @@ -177,6 +177,8 @@ async def dashboards(request: Request, ): """获取一个看板""" res = await crud.dashboard.get(db, id=data_in.id) - # res['reports'] = await crud.report.find_many(db, **{'_id': {'$in': [item['report_id'] for item in res.get('reports')]}}) - data = {item['report_id']: item for item in res['reports']} - return schemas.Msg(code=0, msg='ok', data=data) + reports = {item['report_id']: item for item in res['reports']} + reports_detail = await crud.report.find_many(db, {'_id': {'$in': list(reports.keys())}}, {'query.cachedata': False}) + for item in reports_detail: + reports[item['_id']].update(item) + return schemas.Msg(code=0, msg='ok', data=reports)