Merge Beta with Stable releases #1
@ -10,6 +10,31 @@ from modules.database import col_tmp, col_users, col_context, col_warnings, col_
|
||||
from modules.logging import logWrite
|
||||
from modules.utils import configGet, locale, should_quote
|
||||
|
||||
class DefaultApplicationTemp(dict):
|
||||
def __init__(self, user: int):
|
||||
super().__init__({})
|
||||
self.dict = {
|
||||
"user": user,
|
||||
"type": "application",
|
||||
"complete": False,
|
||||
"sent": False,
|
||||
"state": "fill",
|
||||
"reapply": False,
|
||||
"stage": 1,
|
||||
"application": {
|
||||
"1": None,
|
||||
"2": None,
|
||||
"3": None,
|
||||
"4": None,
|
||||
"5": None,
|
||||
"6": None,
|
||||
"7": None,
|
||||
"8": None,
|
||||
"9": None,
|
||||
"10": None
|
||||
}
|
||||
}
|
||||
|
||||
class UserNotFoundError(Exception):
|
||||
"""HoloUser could not find user with such an ID in database"""
|
||||
def __init__(self, user, user_id):
|
||||
@ -251,32 +276,11 @@ class HoloUser():
|
||||
def application_restart(self) -> None:
|
||||
"""Reset application of a user in tmp collection and replace it with an empty one
|
||||
"""
|
||||
doc = {
|
||||
"user": self.id,
|
||||
"type": "application",
|
||||
"complete": False,
|
||||
"sent": False,
|
||||
"state": "fill",
|
||||
"reapply": False,
|
||||
"stage": 1,
|
||||
"application": {
|
||||
"1": None,
|
||||
"2": None,
|
||||
"3": None,
|
||||
"4": None,
|
||||
"5": None,
|
||||
"6": None,
|
||||
"7": None,
|
||||
"8": None,
|
||||
"9": None,
|
||||
"10": None
|
||||
}
|
||||
}
|
||||
if col_tmp.find_one({"user": self.id, "type": "application"}) is None:
|
||||
col_tmp.insert_one(document=doc)
|
||||
col_tmp.insert_one(document=DefaultApplicationTemp(self.id).dict)
|
||||
else:
|
||||
col_tmp.delete_one({"user": self.id, "type": "application"})
|
||||
col_tmp.insert_one(document=doc)
|
||||
col_tmp.insert_one(document=DefaultApplicationTemp(self.id).dict)
|
||||
|
||||
async def application_next(self, query: str, msg: Message) -> None:
|
||||
"""Move on filling application of user
|
||||
@ -289,27 +293,7 @@ class HoloUser():
|
||||
if col_tmp.find_one({"user": self.id, "type": "application"}) is None:
|
||||
|
||||
col_tmp.insert_one(
|
||||
document={
|
||||
"user": self.id,
|
||||
"type": "application",
|
||||
"complete": False,
|
||||
"sent": False,
|
||||
"state": "fill",
|
||||
"reapply": False,
|
||||
"stage": 1,
|
||||
"application": {
|
||||
"1": None,
|
||||
"2": None,
|
||||
"3": None,
|
||||
"4": None,
|
||||
"5": None,
|
||||
"6": None,
|
||||
"7": None,
|
||||
"8": None,
|
||||
"9": None,
|
||||
"10": None
|
||||
}
|
||||
}
|
||||
document=DefaultApplicationTemp(self.id).dict
|
||||
)
|
||||
|
||||
progress = col_tmp.find_one({"user": self.id, "type": "application"})
|
||||
|
Reference in New Issue
Block a user