починил добавление ивентов

немного расширил функции с базой данных
This commit is contained in:
2022-12-26 18:50:41 +07:00
parent 6437995082
commit fea2530727
4 changed files with 21 additions and 3 deletions
+9 -2
View File
@@ -2,7 +2,11 @@ def add_new_event():
name = input("Введите название ивента\n")
description = input("Введите описание ивента\n")
try:
well = bool(input("Этот ивент хороший?\n"))
well = input("Этот ивент хороший?\n")
if well == "True":
well = True
else:
well = False
except Exception as e:
return e
variants = input("Введите варианты развития ивентов, разделённые */!/*\n").split("*/!/*")
@@ -17,9 +21,12 @@ def add_new_event():
"variants": variants,
"consequence": consequence,
"probability_consequence": probability_consequence,
"probability": 0,
"probability": 50,
"well": well
}
from modules.DB import UseDB
db = UseDB("events")
db.insert_document(response)
return response
else:
return "Длины variants, consequence и probability_consequence не равны"