@@ -306,9 +306,10 @@ impl FlowInstServ {
306
306
pub rel_flow_model_name : String ,
307
307
308
308
pub current_state_id : String ,
309
- pub current_assigned : Option < String > ,
310
-
311
309
pub current_state_name : Option < String > ,
310
+ pub current_state_color : Option < String > ,
311
+
312
+ pub current_assigned : Option < String > ,
312
313
pub current_vars : Option < Value > ,
313
314
314
315
pub create_vars : Option < Value > ,
@@ -327,6 +328,7 @@ impl FlowInstServ {
327
328
pub rel_business_obj_id : String ,
328
329
}
329
330
let rel_state_table = Alias :: new ( "rel_state" ) ;
331
+ let flow_state_table = Alias :: new ( "flow_state" ) ;
330
332
let rel_model_table = Alias :: new ( "rel_model" ) ;
331
333
let mut query = Query :: select ( ) ;
332
334
query
@@ -348,6 +350,7 @@ impl FlowInstServ {
348
350
( flow_inst:: Entity , flow_inst:: Column :: CurrentAssigned ) ,
349
351
] )
350
352
. expr_as ( Expr :: col ( ( rel_state_table. clone ( ) , NAME_FIELD . clone ( ) ) ) . if_null ( "" ) , Alias :: new ( "current_state_name" ) )
353
+ . expr_as ( Expr :: col ( ( flow_state_table. clone ( ) , Alias :: new ( "color" ) ) ) . if_null ( "" ) , Alias :: new ( "current_state_color" ) )
351
354
. expr_as ( Expr :: col ( ( rel_model_table. clone ( ) , NAME_FIELD . clone ( ) ) ) . if_null ( "" ) , Alias :: new ( "rel_flow_model_name" ) )
352
355
. from ( flow_inst:: Entity )
353
356
. join_as (
@@ -359,6 +362,12 @@ impl FlowInstServ {
359
362
. add ( Expr :: col ( ( rel_state_table. clone ( ) , REL_KIND_ID_FIELD . clone ( ) ) ) . eq ( FlowStateServ :: get_rbum_kind_id ( ) . unwrap ( ) ) )
360
363
. add ( Expr :: col ( ( rel_state_table. clone ( ) , REL_DOMAIN_ID_FIELD . clone ( ) ) ) . eq ( FlowStateServ :: get_rbum_domain_id ( ) . unwrap ( ) ) ) ,
361
364
)
365
+ . join_as (
366
+ JoinType :: LeftJoin ,
367
+ Alias :: new ( "flow_state" ) ,
368
+ flow_state_table. clone ( ) ,
369
+ Expr :: col ( ( flow_state_table. clone ( ) , ID_FIELD . clone ( ) ) ) . equals ( ( flow_inst:: Entity , flow_inst:: Column :: CurrentStateId ) ) ,
370
+ )
362
371
. join_as (
363
372
JoinType :: LeftJoin ,
364
373
RBUM_ITEM_TABLE . clone ( ) ,
@@ -388,8 +397,9 @@ impl FlowInstServ {
388
397
own_paths : inst. own_paths ,
389
398
transitions : inst. transitions . map ( |transitions| TardisFuns :: json. json_to_obj ( transitions) . unwrap ( ) ) ,
390
399
current_state_id : inst. current_state_id ,
391
- current_assigned : inst. current_assigned ,
392
400
current_state_name : inst. current_state_name ,
401
+ current_state_color : inst. current_state_color ,
402
+ current_assigned : inst. current_assigned ,
393
403
current_vars : inst. current_vars . map ( |current_vars| TardisFuns :: json. json_to_obj ( current_vars) . unwrap ( ) ) ,
394
404
rel_business_obj_id : inst. rel_business_obj_id ,
395
405
} )
@@ -1224,7 +1234,7 @@ impl FlowInstServ {
1224
1234
. from ( flow_inst:: Entity )
1225
1235
. and_where ( Expr :: col ( ( flow_inst:: Entity , flow_inst:: Column :: CurrentStateId ) ) . eq ( flow_state_id) )
1226
1236
. and_where ( Expr :: col ( ( flow_inst:: Entity , flow_inst:: Column :: RelFlowModelId ) ) . eq ( flow_model_id) )
1227
- . and_where ( Expr :: col ( ( flow_inst:: Entity , flow_inst:: Column :: FinishAbort ) ) . eq ( false ) ) ,
1237
+ . and_where ( Expr :: col ( ( flow_inst:: Entity , flow_inst:: Column :: FinishAbort ) ) . ne ( true ) ) ,
1228
1238
)
1229
1239
. await ?
1230
1240
!= 0
0 commit comments