From fea25307270db73f2d13315c9116010b3697ff6d Mon Sep 17 00:00:00 2001 From: Dmitrium12 Date: Mon, 26 Dec 2022 18:50:41 +0700 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=87=D0=B8=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B8=D0=B2=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=BD=D0=B5=D0=BC?= =?UTF-8?q?=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=80=D0=B0=D1=81=D1=88=D0=B8=D1=80?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D1=81=20=D0=B1=D0=B0=D0=B7=D0=BE=D0=B9=20=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/config.ini | 2 +- conf/debug_functions.py | 11 +++++++++-- modules/DB.py | 3 +++ test.py | 8 ++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) 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