From 055b04d53d4985e10f93594f18d0039a9d77b11a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=AD=A6=E5=B3=B0?= Date: Wed, 22 May 2024 16:45:31 +0800 Subject: [PATCH 1/3] fix:case filter --- dist/index.html | 4 ++-- services/case_service.py | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dist/index.html b/dist/index.html index 9e8888e..dfe82bc 100644 --- a/dist/index.html +++ b/dist/index.html @@ -8,10 +8,10 @@ - +
- + \ No newline at end of file diff --git a/services/case_service.py b/services/case_service.py index 8a310f0..40dfb08 100644 --- a/services/case_service.py +++ b/services/case_service.py @@ -531,17 +531,19 @@ async def search_case(data): node_list = await __search_child_nodes_by_path(node.path) conditions.append(Case.parent.in_(node_list)) if 'labels' in data: - case_ids = await get_cases_by_label_names(data['labels'].split(',')) + case_ids = await get_cases_by_label_names(data.get('labels').split(',')) conditions.append(Case.id.in_(case_ids)) if 'is_available' in data: result = True if data.get('is_available') == 'true' else False conditions.append(Case.is_available == result) if 'priority' in data: pr_list = list() - for pr in data['priority'].split(','): + for pr in data.get('priority').split(','): if __get_priority(pr): pr_list.append(__get_priority(pr)) conditions.append(Case.priority.in_(pr_list)) + if 'type' in data: + conditions.append(Case.type == data.get('type')) if 'test_type' in data: conditions.append(Case.type == data.get('test_type')) if 'run_method' in data: @@ -560,16 +562,16 @@ async def search_case(data): if end_time: end_time = string_toShortDatetime(end_time) conditions.append(Case.gmt_modified <= end_time) - if 'device_type' in data and Device_Type_EN.UNLIMIT.value not in data['device_type']: + if 'device_type' in data and Device_Type_EN.UNLIMIT.value not in data.get('device_type').split(','): device_type_list = list() device_type_list.append(Case.device_type == Device_Type_EN.UNLIMIT.value) - for item in data['device_type']: + for item in data.get('device_type').split(','): device_type_list.append(Case.device_type.contains(item)) multi_condition.append(or_(*device_type_list)) - if 'device_arch' in data and Device_Arch.NOARCH.value not in data['device_arch']: + if 'device_arch' in data and Device_Arch.NOARCH.value not in data.get('device_arch').split(','): device_type_list = list() device_type_list.append(Case.device_type == Device_Type_EN.UNLIMIT.value) - for item in data['device_type']: + for item in data.get('device_arch').split(','): device_type_list.append(Case.device_type.contains(item)) multi_condition.append(or_(*device_type_list)) if 'key' in data: @@ -595,7 +597,7 @@ def __get_priority(pr): async def excel_template(): - filepath = 'common/dist/temp.xlsx' + filepath = 'common/static/temp.xlsx' with open(filepath, "rb") as f: content = f.read() return content -- Gitee From 35af200352178161e06f86149b0abb5b3a0c6da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=AD=A6=E5=B3=B0?= Date: Wed, 22 May 2024 17:11:40 +0800 Subject: [PATCH 2/3] fix:case filter --- services/task_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/task_service.py b/services/task_service.py index 700750b..931da56 100644 --- a/services/task_service.py +++ b/services/task_service.py @@ -141,7 +141,7 @@ async def modify_task(data, task_id, user): task.config = data['config'] if 'cases' in data: if data['cases']: - case_infos = await __gen_run_result_case_infos(data['cases'].split(',')) + case_infos = await __gen_run_result_case_infos(data['cases']) task.run_result['case_infos'] = case_infos else: task.run_result['case_infos'] = [] -- Gitee From daee52c9aaeb63f9ef7e3bb87a4cdede89a8c2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=AD=A6=E5=B3=B0?= Date: Thu, 23 May 2024 10:56:01 +0800 Subject: [PATCH 3/3] fix:export case --- dist/index.html | 2 +- services/case_service.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.html b/dist/index.html index dfe82bc..0553e18 100644 --- a/dist/index.html +++ b/dist/index.html @@ -12,6 +12,6 @@
- + \ No newline at end of file diff --git a/services/case_service.py b/services/case_service.py index 40dfb08..84f5505 100644 --- a/services/case_service.py +++ b/services/case_service.py @@ -507,12 +507,12 @@ async def export_excel(case_ids): content['执行模式'].append(case.run_model.value) content['是否可用'].append(case.is_available) content['关联的tone用例'].append(case.tone_case) - content['设备类型'].append(case.device_type.value) - content['设备架构'].append(case.device_arch.value) + content['设备类型'].append(case.device_type) + content['设备架构'].append(case.device_arch) content['所属模块'].append(case_nodes_dict[case.parent]) content['创建时间'].append(case.gmt_created) content['改动时间'].append(case.gmt_modified) - content['用例描述'].append(case.base_fields) + content['用例描述'].append(case.desc) content['扩展'].append(case.custom_fields) return await write_excel(content) -- Gitee