6b799f4d by 周伟奇

Merge branch 'fix/1119' into feature/1119

2 parents 59f58c93 657b81ef
......@@ -944,11 +944,17 @@ class CompareResultView(GenericView):
else:
whole_result = consts.RESULT_Y if result_obj.is_finish else consts.RESULT_N
if result_obj is None or result_obj.comments is None:
if result_obj is None or not isinstance(result_obj.comments, str):
comments = ''
else:
comments = result_obj.comments
if result_obj is None or not isinstance(result_obj.version, str):
source = ''
version = ''
else:
source, version = result_obj.version.split(consts.SPLIT_STR)
compare_result = {
'id': 0 if result_obj is None else result_obj.id,
'application_id': case_id,
......@@ -956,8 +962,8 @@ class CompareResultView(GenericView):
'scheme': consts.DOC_SCHEME_LIST[0] if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else consts.DOC_SCHEME_LIST[1],
'whole_result': whole_result,
'latest_compared_time': '' if result_obj is None else result_obj.update_time.strftime('%Y-%m-%d %H:%M'),
'source': '' if result_obj is None else result_obj.version.split(consts.SPLIT_STR)[0],
'version': '' if result_obj is None else result_obj.version.split(consts.SPLIT_STR)[1],
'source': source,
'version': version,
'comments': comments,
'result': [] if result_obj is None else json.loads(result_obj.result)
}
......@@ -1065,20 +1071,29 @@ class CompareResultView(GenericView):
else:
whole_result = consts.RESULT_Y if result_obj.is_finish else consts.RESULT_N
comments = '' if result_obj.comments is None else result_obj.comments
if isinstance(result_obj.comments, str):
comments = result_obj.comments
else:
comments = ''
if isinstance(result_obj.version, str):
source, version = result_obj.version.split(consts.SPLIT_STR)
else:
source = ''
version = ''
compare_result = {
'id': 0 if result_obj is None else result_obj.id,
'id': result_obj.id,
'application_id': case_id,
'entity': entity,
'scheme': consts.DOC_SCHEME_LIST[0] if scheme == consts.COMPARE_DOC_SCHEME_LIST[0] else
consts.DOC_SCHEME_LIST[1],
'whole_result': whole_result,
'latest_compared_time': '' if result_obj is None else result_obj.update_time.strftime('%Y-%m-%d %H:%M'),
'source': '' if result_obj is None else result_obj.version.split(consts.SPLIT_STR)[0],
'version': '' if result_obj is None else result_obj.version.split(consts.SPLIT_STR)[1],
'latest_compared_time': result_obj.update_time.strftime('%Y-%m-%d %H:%M'),
'source': source,
'version': version,
'comments': comments,
'result': [] if result_obj is None else json.loads(result_obj.result)
'result': json.loads(result_obj.result)
}
return response.need_update(data=compare_result)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!