From 5aa35c7bdd5c1bbaf80a6ef230d767c179b5e334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80=C3=AE=C3=97=C3=9A=C3=95=C3=B1?= Date: Mon, 19 Sep 2022 11:31:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/interview.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/api/api_v1/endpoints/interview.py b/api/api_v1/endpoints/interview.py index 3c6110d..aedcc4c 100644 --- a/api/api_v1/endpoints/interview.py +++ b/api/api_v1/endpoints/interview.py @@ -1161,11 +1161,22 @@ async def find_mode_tables( """获取一条hr分组包含的报表""" mode_data = await crud.api_interview_modes.get_one_mode(db, data_in.mode_id) table_data = [] + new_table_data = [] if mode_data: tables = mode_data['mode_list'] if tables: table_data = await crud.api_interview_tables.get_tables(db, {'table_id': {'$in': tables}}) - return schemas.Msg(code=200, msg='ok', data=table_data) + if table_data: + for data in table_data: + table_id = data.get('table_id') + sort_key = tables.index(table_id) + data.update({'sort_key': sort_key}) + new_data = deepcopy(data) + new_table_data.append(new_data) + if new_table_data: + new_table_data.sort(key=lambda i: i.get('sort_key')) + + return schemas.Msg(code=200, msg='ok', data=new_table_data) @router.post("/update_mode") @@ -2222,11 +2233,11 @@ async def interviews( res1 = chkData(data1) data2 = await ckdb.execute(sql2) res2 = chkData(data2) - res3=[] - datas={'later':res, # 今天及之后的面试 - 'teacher_true':res1, # 已反馈的面试 - 'later_false':res2, # 未反馈的面试 - 'later_invalid':res3} # 已失效的面试 + res3 = [] + datas = {'later': res, # 今天及之后的面试 + 'teacher_true': res1, # 已反馈的面试 + 'later_false': res2, # 未反馈的面试 + 'later_invalid': res3} # 已失效的面试 return schemas.Msg(code=200, msg='ok', data=datas) @@ -2259,6 +2270,6 @@ async def interview_teacher( """ 获取面试反馈 """ sql = f"""select uid,teacher_back,teacher_txt from HR.resumes WHERE uid = '{data_in.uid}' limit 1""" print(sql) - res=await ckdb.execute(sql) - data=chkData(res) - return schemas.Msg(code=200, msg='ok', data=data) \ No newline at end of file + res = await ckdb.execute(sql) + data = chkData(res) + return schemas.Msg(code=200, msg='ok', data=data)