Skip to content

Commit

Permalink
flow: fix bug (state filter by rel_model_ids) (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZzIsGod1019 authored Jul 5, 2024
1 parent db807ff commit c6b7f9c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
11 changes: 10 additions & 1 deletion backend/middlewares/flow/src/serv/flow_event_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ impl FlowEventServ {
fn do_check_front_condition(current_vars: &HashMap<String, Value>, condition: &FlowTransitionFrontActionInfo) -> TardisResult<bool> {
match condition.right_value {
FlowTransitionFrontActionRightValue::ChangeContent => {
if let Some(left_value) = current_vars.get(&condition.left_value) {
let left_value = if let Some(custom_value) =
current_vars.get(&format!("custom_{}", condition.left_value))
{
Some(custom_value)
} else if let Some(original_value) = current_vars.get(&condition.left_value) {
Some(original_value)
} else {
None
};
if let Some(left_value) = left_value {
Ok(condition.relevance_relation.check_conform(
left_value.as_str().unwrap_or(left_value.to_string().as_str()).to_string(),
condition
Expand Down
9 changes: 2 additions & 7 deletions backend/middlewares/flow/src/serv/flow_model_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ impl RbumItemCrudOperation<flow_model::ActiveModel, FlowModelAddReq, FlowModelMo
subject: "工作流模板".to_string(),
name: add_req.name.to_string(),
sub_kind: "flow_template".to_string(),
// id=nImib1jBLmBgw8wKxpgnC&
// name=t%E5%B7%B2%E5%AE%8C%E6%88%901-%E7%A7%9F%E6%88%B7%E5%BE%85%E5%BC%80%E5%A7%8B1
// &info=AA&rel_template_ids=01c72f409e01baf165bc55ac018f91de
// &rel_template_ids=245e12dc0248366325529280b0b0c2c7
// &scope_level=L1
// &tag=REQ
},
Some(json!({
"name": add_req.name.to_string(),
Expand Down Expand Up @@ -1137,6 +1131,7 @@ impl FlowModelServ {
&mut FlowModelAddReq {
rel_model_id: None,
rel_template_ids: None,
template: rbum_scope_helper::get_scope_level_by_context(&mock_ctx)? != RbumScopeLevelKind::L2,
..rel_model.clone().into()
},
funs,
Expand Down Expand Up @@ -1451,7 +1446,7 @@ impl FlowModelServ {
funs,
ctx,
)
.await?;
.await?.into_iter().filter(|tran| tran.id != transition_detail.id).collect_vec();
for transition_detail in transitions {
(is_ring, current_chain) = Self::check_post_action_ring(transition_detail, (is_ring, current_chain.clone()), funs, ctx).await?;
if is_ring {
Expand Down
6 changes: 2 additions & 4 deletions backend/middlewares/flow/src/serv/flow_state_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,7 @@ impl RbumItemCrudOperation<flow_state::ActiveModel, FlowStateAddReq, FlowStateMo
state_id.extend(rel_state_id.into_iter());
}

if !state_id.is_empty() {
query.and_where(Expr::col((flow_state::Entity, flow_state::Column::Id)).is_in(state_id));
}
query.and_where(Expr::col((flow_state::Entity, flow_state::Column::Id)).is_in(state_id));
}
Ok(())
}
Expand Down Expand Up @@ -473,7 +471,7 @@ impl FlowStateServ {
&exists_state.id,
None,
None,
false,
true,
true,
Some(rel.rel.ext),
funs,
Expand Down

0 comments on commit c6b7f9c

Please sign in to comment.