Skip to content
Snippets Groups Projects
Commit 5485136c authored by George Marchment's avatar George Marchment
Browse files

fixed bug in userview

parent 2226adba
No related branches found
No related tags found
No related merge requests found
Pipeline #14120 passed with stage
in 3 minutes and 16 seconds
......@@ -608,7 +608,25 @@ def get_color_node(node, new_nodes):
prop = 256- int(127*len(node)/max)
return rgb_to_hex(prop, prop, prop)
def relev_user_view_builder(dico, relevant_modules):
def relev_user_view_builder(dico_param, relevant_modules):
import time
dico = copy.deepcopy(dico_param)
tag = str(time.time())
#Add this to simplify the use of duplicate processes
nodes_2_num = {}
for node in dico["nodes"]:
nodes_2_num[node['name']] = 0
for node in dico["nodes"]:
tmp = nodes_2_num[node['name']]
nodes_2_num[node['name']]+=1
node['name'] = f"{node['name']}{tag}{tmp}"
tab_temp = []
for n in relevant_modules:
for i in range(0, nodes_2_num[n]):
tab_temp.append(f"{n}{tag}{i}")
relevant_modules = tab_temp
R = []
for r in relevant_modules:
R+=get_id_from_name(dico, r)
......@@ -700,11 +718,18 @@ def relev_user_view_builder(dico, relevant_modules):
for n in V_minus:
if(not check_same_elements(rSucc(n, dico, R, ['output']), rSuccM(M, dico, R, ["output"]))):
condition_left = False
if(condition_left and condition_right):
if(condition_left and condition_right):
NRC.remove(M1)
NRC.remove(M2)
NRC.append(M)
changes_in_NRC = True
break
if(changes_in_NRC):
break
if(changes_in_NRC):
break
new_nodes = list(U)+NRC
new_dico = {}
......@@ -715,7 +740,7 @@ def relev_user_view_builder(dico, relevant_modules):
new_nodes[i].sort()
new_name = get_name_new_node(get_names_tab(dico, new_nodes[i]), relevant_modules)
node = {"id": ''.join(new_nodes[i]).replace('<', '').replace('>', ''),
"name": new_name,
"name": new_name.split(tag)[0],
"shape": "ellipse",
"xlabel": f"{len(new_nodes[i])}",
"fillcolor": get_color_node(new_nodes[i], new_nodes)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment