From 91c8ecc760e962db35491a3aad85d7444f24121d Mon Sep 17 00:00:00 2001 From: wuaho Date: Mon, 30 Aug 2021 16:52:02 +0800 Subject: [PATCH] 1 --- api/api_v1/endpoints/dashboard.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/api/api_v1/endpoints/dashboard.py b/api/api_v1/endpoints/dashboard.py index 9aa7b3e..6bee891 100644 --- a/api/api_v1/endpoints/dashboard.py +++ b/api/api_v1/endpoints/dashboard.py @@ -104,12 +104,17 @@ async def copy( new_report_id = get_uid() new_report['_id'] = new_report_id new_report['project_id'] = dest_project_id - await crud.report.insert_one(db, new_report) - - await crud.dashboard.update_one(db, - {'project_id': item['project_id'], 'name': item['name'], - 'user_id': item['user_id']}, {'$set': item}, - upsert=True) + try: + await crud.report.insert_one(db, new_report) + except: + pass + try: + await crud.dashboard.update_one(db, + {'project_id': item['project_id'], 'name': item['name'], + 'user_id': item['user_id']}, {'$set': item}, + upsert=True) + except: + pass return schemas.Msg(code=0, msg='ok', data='倍刢成功')