Conditional formatting statuses hydration β
Algorithm β
mermaid
flowchart TD
start_process(Start)
fetch_all_active_cf_rules("Fetch all active cf rules [1]")
check_cf_should_be_applied("Check if cf level equals item level and check if current item is concerned by at least one cf rule")
get_all_cf_item_rules("With found ids, retrieve all cf item rules")
is_item_or_rowdata{Is item or rowdata ?}
is_item_or_rowdata2{Is item or rowdata ?}
foreach_item_batch[For each item batch]
start_process --> fetch_all_active_cf_rules
fetch_all_active_cf_rules --> foreach_item_batch
foreach_item_batch --> is_item_or_rowdata
is_item_or_rowdata -.-> |Rowdata| s2_for_each_rowdata
is_item_or_rowdata -.-> |item| s1_for_each_item
subgraph "Get all items ids"
s1_for_each_item["For each item"] --> recursively_browse_children
recursively_browse_children(store id and browse children recursively to get children id)
end
subgraph "Get all rowdata ids"
s2_for_each_rowdata["For each rowdata"] --> s2_rowdata
s2_rowdata["store id and browse parent until level 1"]
end
recursively_browse_children --> get_all_cf_item_rules
s2_rowdata --> get_all_cf_item_rules
subgraph "Item hydration logic"
s3_for_each_item["For each item and item children"] --> s3_retrieve_classification
s3_retrieve_classification("Fetch root item classifications [2]")
s3_retrieve_classification --> s3_foreach_cf[For each cf]
end
subgraph "Rowdata hydration logic"
s4_for_each_rowdata["For each rowdata"] --> s4_foreach_cf
s4_foreach_cf["For each cf"]
end
subgraph "Cf status hydration"
hydrate_status("status hydration logic")
no_cf_item_rule_found{"If No cf item rule found for current item"}
for_each_cf_item_rule["For each cf item rule found"]
cf_item_rule_found_but_expired["Cf item rule found but expired [3]"]
non_valid_cf_item_rule_found{"Non-valid cf item rule found"}
a_status_already_found_for_item["A status is already found for this cf and element"]
newest_status_priority_is_strongest["Current status priority is strongest than the previous one [4]"]
apply_status_for_cf("store this status for this cf")
zero_non_valid_cf_item_rule_found["No non valid cf item rule found"]
apply_default_status_for_cf("Apply default status for this cf")
is_processing("Is processing")
hydrate_status --> no_cf_item_rule_found
no_cf_item_rule_found -.-> |Yes| is_processing
no_cf_item_rule_found -.-> |No| for_each_cf_item_rule
for_each_cf_item_rule --> cf_item_rule_found_but_expired
cf_item_rule_found_but_expired -.-> |Yes| is_processing
cf_item_rule_found_but_expired -.-> |No| non_valid_cf_item_rule_found
non_valid_cf_item_rule_found -.-> |Yes| a_status_already_found_for_item
non_valid_cf_item_rule_found -.-> |No| zero_non_valid_cf_item_rule_found
a_status_already_found_for_item -.-> |Yes| newest_status_priority_is_strongest
newest_status_priority_is_strongest -.-> |Yes| apply_status_for_cf
zero_non_valid_cf_item_rule_found -.-> |Yes| apply_default_status_for_cf
end
get_all_cf_item_rules --> is_item_or_rowdata2
is_item_or_rowdata2 -.-> |Rowdata| s4_for_each_rowdata
is_item_or_rowdata2 -.-> |item| s3_for_each_item
s3_foreach_cf --> check_cf_should_be_applied
s4_foreach_cf --> check_cf_should_be_applied
check_cf_should_be_applied --> hydrate_status;- An active cf rule is an active rule targeting an active field and an active category if the field is specific.
- Classifications are applied only on the level of index 1. Only cf rules targeting item categories should be applied.
- A CF item rule is expired when item update date or cf rule update date is greater than cf item rule update date.
- A CF status with a priority 1 is "strongest" than a CF status with a priority 2. If 2 non-valid CF item rules are found we have to apply the highest priority status.