diff --git a/conf/config.ini b/conf/config.ini index bc2931c..d97d121 100644 --- a/conf/config.ini +++ b/conf/config.ini @@ -1,4 +1,4 @@ [Settings] -difficulty = Проигрывать весело +difficulty = sound = True diff --git a/conf/debug_functions.py b/conf/debug_functions.py index 118752d..5c98c7f 100644 --- a/conf/debug_functions.py +++ b/conf/debug_functions.py @@ -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 не равны" diff --git a/modules/DB.py b/modules/DB.py index 5cb0ca8..c4baad3 100644 --- a/modules/DB.py +++ b/modules/DB.py @@ -16,3 +16,6 @@ class UseDB: def update_document(self, query_elements, new_values): self.series_collection.update_one(query_elements, {'$set': new_values}) + + def del_document(self, query_elements): + self.series_collection.delete_one(query_elements) diff --git a/test.py b/test.py index e69de29..d6478fc 100644 --- a/test.py +++ b/test.py @@ -0,0 +1,8 @@ +from modules.DB import UseDB + +db = UseDB("events") +for i in db.find_document({}): + print(i) + # db.del_document({"name": i["name"]}) +# db.update_document({"name": "test not bad"}, {"probability": 50}) +db.update_document({"name": "test bad "}, {"probability": 50}) \ No newline at end of file