Commit 8c60fe76 authored by Nicolas  MAILLET's avatar Nicolas MAILLET
Browse files

bugfix, protect name of a new enzyme to another one can't take the same

parent f48e49bf
...@@ -252,14 +252,16 @@ def user_creation_enzyme(all_enzymes): ...@@ -252,14 +252,16 @@ def user_creation_enzyme(all_enzymes):
.. warning:: It could be a problem to immediately use the new enzyme (see in-code warning) .. warning:: It could be a problem to immediately use the new enzyme (see in-code warning)
""" """
add_enzyme = "y" add_enzyme = "y"
# All enzymes name
all_name_enz = set()
# Get all used names
for enz in all_enzymes:
all_name_enz.add(enz.name)
# Adding enzyme # Adding enzyme
while add_enzyme == "y": while add_enzyme == "y":
# All enzymes name
all_name_enz = set()
# Get all used names
for enz in all_enzymes:
all_name_enz.add(enz.name)
# Name of the enzyme # Name of the enzyme
name_new_enz = input("Name of the new enzyme?\n") name_new_enz = input("Name of the new enzyme?\n")
...@@ -317,5 +319,8 @@ def user_creation_enzyme(all_enzymes): ...@@ -317,5 +319,8 @@ def user_creation_enzyme(all_enzymes):
# Write in the user-defined enzymes file # Write in the user-defined enzymes file
new_enz.write_enzyme_in_user_file() new_enz.write_enzyme_in_user_file()
# Add it to known names
all_name_enz.add(new_enz.name)
# End of this new enzyme # End of this new enzyme
add_enzyme = input("Add an other enzyme? (y/n)\n") add_enzyme = input("Add an other enzyme? (y/n)\n")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment