SGP: fix case swap menu position & brew time percent not update, toggle enable membership flow
This commit is contained in:
parent
5e109800c0
commit
69217981b3
10 changed files with 258 additions and 194 deletions
|
|
@ -434,26 +434,44 @@ if "multi_promotion" in param:
|
|||
print("reorder mode")
|
||||
order_list = promotion_config["reorder"]
|
||||
print(json.dumps(order_list, indent=2), " while ", json.dumps(filter_sm, indent=2))
|
||||
buffer_key = ""
|
||||
# sort by has_order
|
||||
for filtered in filter_sm:
|
||||
print("try reorder", filtered, order_list)
|
||||
# get index from order
|
||||
expect_index = order_list.index(filtered)
|
||||
# interact_idx[0] = expect_index
|
||||
print("get expect = ", expect_index)
|
||||
current_index = filter_sm.index(filtered)
|
||||
# interact_idx[1] = current_index
|
||||
print("get current = ", current_index)
|
||||
is_matched_index = expect_index != -1 and expect_index == current_index
|
||||
print(f"check match {filtered}: ", not is_matched_index)
|
||||
if not is_matched_index:
|
||||
print(f"swap current={filtered}@{current_index} to position@{expect_index} was {filter_sm[expect_index]}")
|
||||
buffer_key = filter_sm[expect_index]
|
||||
filter_sm[expect_index] = filtered
|
||||
filter_sm[current_index] = buffer_key
|
||||
buffer_key = ""
|
||||
# buffer_key = ""
|
||||
|
||||
# new_sorted_list = [
|
||||
# "",
|
||||
# "",
|
||||
# "",
|
||||
# ""
|
||||
# ]
|
||||
|
||||
filter_sm = order_list
|
||||
|
||||
# sort by has_order
|
||||
# for filtered in filter_sm:
|
||||
# print("try reorder", filtered, order_list)
|
||||
# # get index from order
|
||||
# expect_index = order_list.index(filtered)
|
||||
# # interact_idx[0] = expect_index
|
||||
# print("get expect = ", expect_index)
|
||||
# current_index = filter_sm.index(filtered)
|
||||
# # interact_idx[1] = current_index
|
||||
# print("get current = ", current_index)
|
||||
# is_matched_index = expect_index != -1 and expect_index == current_index
|
||||
# print(f"check match {filtered}: ", not is_matched_index)
|
||||
|
||||
|
||||
# # apply to new list
|
||||
# new_sorted_list[expect_index] = filtered
|
||||
|
||||
|
||||
|
||||
# if not is_matched_index:
|
||||
# print(f"swap current={filtered}@{current_index} to position@{expect_index} was {filter_sm[expect_index]}")
|
||||
# buffer_key = filter_sm[expect_index]
|
||||
# filter_sm[expect_index] = filtered
|
||||
# filter_sm[current_index] = buffer_key
|
||||
# buffer_key = ""
|
||||
|
||||
# print("final reorder \n\n",filter_sm,order_list,"\n\n", new_sorted_list ,"\n\n")
|
||||
# try get block
|
||||
generated_block_buffer = ""
|
||||
for sm_menu in filter_sm:
|
||||
|
|
@ -470,8 +488,8 @@ if "multi_promotion" in param:
|
|||
curr_sm_block = curr_sm_block.replace(",$Sum", ",Disable=Invisible,$Sum").replace("\\n", "\\\\n")
|
||||
generated_block_buffer += curr_sm_block
|
||||
|
||||
if "52-05-02-0076" in sm_menu:
|
||||
print("52-05-02-0076", generated_block_buffer)
|
||||
# if "52-05-02-0076" in sm_menu:
|
||||
# print("52-05-02-0076", generated_block_buffer)
|
||||
except:
|
||||
print("Cannot find store block for ", sm_menu)
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue