initial commit
This commit is contained in:
BIN
utils/chapter_tools/__pycache__/csx_chapter.cpython-313.pyc
Normal file
BIN
utils/chapter_tools/__pycache__/csx_chapter.cpython-313.pyc
Normal file
Binary file not shown.
BIN
utils/chapter_tools/__pycache__/csx_chapter.cpython-38.pyc
Normal file
BIN
utils/chapter_tools/__pycache__/csx_chapter.cpython-38.pyc
Normal file
Binary file not shown.
18
utils/chapter_tools/csx_chapter.py
Normal file
18
utils/chapter_tools/csx_chapter.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from apps.project.models import Round
|
||||
from utils.util import get_dict_info
|
||||
|
||||
def create_csx_chapter_dict(one_round: Round):
|
||||
"""传入轮次对象,返回测试项类型字典key的数组/测试项key的dict,以便后续使用"""
|
||||
testType_list = []
|
||||
last_chapter_items = {}
|
||||
if one_round:
|
||||
for csx in one_round.rtField.all():
|
||||
if csx.testType not in testType_list:
|
||||
testType_list.append(csx.testType)
|
||||
# 排序需要查字典里面index来排序
|
||||
testType_list.sort(key=lambda x: get_dict_info('testType', x)['index'], reverse=False)
|
||||
for test_type in testType_list:
|
||||
last_chapter_items[test_type] = []
|
||||
for csx in one_round.rtField.all():
|
||||
last_chapter_items[csx.testType].append(csx.key)
|
||||
return testType_list, last_chapter_items
|
||||
Reference in New Issue
Block a user