排序
This commit is contained in:
parent
0206d806a4
commit
5aa35c7bdd
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user