diff --git a/api/api_v1/endpoints/dashboard.py b/api/api_v1/endpoints/dashboard.py index 08e49b0..d8566c8 100644 --- a/api/api_v1/endpoints/dashboard.py +++ b/api/api_v1/endpoints/dashboard.py @@ -84,8 +84,11 @@ async def copy( item['_id'] = get_uid() for report in item['reports']: report_id = report['report_id'] - new_report = crud.report.get(db, report_id) - new_report['_id'] = get_uid() + new_report = await crud.report.get(db, report_id) + new_report_id = get_uid() + new_report['_id'] = new_report_id + new_report['project_id'] = dest_project_id + report['report_id'] = new_report_id await crud.report.insert_one(db, new_report) await crud.dashboard.update_one(db, diff --git a/utils/func.py b/utils/func.py index 359e8bb..8214c58 100644 --- a/utils/func.py +++ b/utils/func.py @@ -2,4 +2,4 @@ import time def get_uid(): - return hex(int(time.time() * 1000 * 10 ** 6))[2:] + return hex(int(time.time() * 10 ** 7))[2:]