Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在自动审核模式中,上线工单存在检测错误或警告时,并匹配auto_rwview_wrong参数时,工单状态应为自动审核不通过;在客户端JS脚本中增加脚本错误数的判断 #2692

Closed
wants to merge 21 commits into from
Closed
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion sql/utils/workflow_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ def is_auto_review(self) -> bool:
def generate_audit_setting(self) -> AuditSetting:
if self.is_auto_review():
return AuditSetting(auto_pass=True)

if self.workflow_type in [WorkflowType.SQL_REVIEW, WorkflowType.QUERY]:
group_id = self.workflow.group_id

else:
# ArchiveConfig
group_id = self.resource_group_id
Expand Down Expand Up @@ -300,6 +300,22 @@ def create_audit(self) -> str:
create_user=create_user,
create_user_display=create_user_display,
)
if (
audit_setting.auto_pass
and self.workflow.status == "workflow_autoreviewwrong"
):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

无需判断是否 auto_pass, 逻辑更清晰

Suggested change
if (
audit_setting.auto_pass
and self.workflow.status == "workflow_autoreviewwrong"
):
if self.workflow.status == "workflow_autoreviewwrong":

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的想法是手工确认的模式下,不执行自动驳回

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不行, 你的这个需求是 breaking change 了, 需要做系统配置控制行为

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你需要, 可以独立成一个函数, should_reject , 然后你定制开发时覆盖这个函数即可. 这样也可以控制审批流的行为.

参考:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

意思是对于错误工单,提交后可以修改?
这样当然是好的,但是这个状态怎么设置,没搞清楚

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前面我也问了,这个“breaking change”是什么意思,没搞明白。
在自动审核模式下,存在错误的工单,不应该驳回吗? 还需要参数进行开关?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

breaking change 就是和之前版本不一致的行为,对于你的两个问题我就不重复回答了,请参照上方粗体部分的说明。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得需要分析的是,是否存在其它场景,不符合我实现的逻辑。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可能还是有一些矛盾在的哈,我觉得我观点都表达到位了。如果没有代码改变,新的观点或论据,我就不反复沟通了。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前的实现与原来的逻辑基本没有差别了,只是在判断是否自动通过时,增加了对存在审核错误的检查,其实和最早的实现类似。
另外增加了一个系统参数,是否要允许错误脚本提交(仅自动审核模式下),目前是在客户端脚本里进行判断。

self.audit.current_status = WorkflowStatus.REJECTED
self.audit.save()
WorkflowLog.objects.create(
audit_id=self.audit.audit_id,
operation_type=WorkflowAction.SUBMIT,
operation_type_desc=WorkflowAction.SUBMIT.label,
operation_info="工单存在检测异常,系统自动驳回",
operator=self.audit.create_user,
operator_display=self.audit.create_user_display,
)
return "工单存在检测异常,系统自动驳回"

# 自动通过的情况
if audit_setting.auto_pass:
self.audit.current_status = WorkflowStatus.PASSED
Expand Down
Loading