mirror of
https://github.com/Justuser3310/ss14_chemistry_site.git
synced 2025-02-08 09:07:38 +00:00
штуки без рецептов вновь в БД. зачем? надо.
This commit is contained in:
parent
873c221bb9
commit
982c078b58
@ -69,6 +69,8 @@ class Reagent:
|
|||||||
@property
|
@property
|
||||||
def recipe(self):
|
def recipe(self):
|
||||||
result = []
|
result = []
|
||||||
|
if not self.__recipe:
|
||||||
|
return result
|
||||||
for item in self.__recipe:
|
for item in self.__recipe:
|
||||||
# Приводим к НОРМАЛЬНОМУ виду
|
# Приводим к НОРМАЛЬНОМУ виду
|
||||||
# "Бикаридин": [ [0, "Углерод", 1], [1, "Инапровалин"] ]
|
# "Бикаридин": [ [0, "Углерод", 1], [1, "Инапровалин"] ]
|
||||||
@ -129,7 +131,7 @@ for item in yaml.load(requests.get(RECIPES_URL).content.decode("utf-8"), Loader=
|
|||||||
item["reactants"]}
|
item["reactants"]}
|
||||||
content[item["id"]]["products"] = item["products"]
|
content[item["id"]]["products"] = item["products"]
|
||||||
|
|
||||||
reagents = [Reagent(init_data=content[item]) for item in content if "reactants" in content[item]]
|
reagents = [Reagent(init_data=content[item]) for item in content] # if "reactants" in content[item]]
|
||||||
|
|
||||||
db = {x.name: x.recipe for x in reagents}
|
db = {x.name: x.recipe for x in reagents}
|
||||||
with open("db.json", mode="w", encoding="utf-8") as db_file:
|
with open("db.json", mode="w", encoding="utf-8") as db_file:
|
||||||
|
Loading…
Reference in New Issue
Block a user