Skip to content

Commit

Permalink
Fix issue to update over current database (yashoswalyo#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashoswalyo authored Oct 18, 2022
1 parent a3011f9 commit cb86fb1
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,29 @@ def __init__(self, uid: int, name:str):
# def __init__(self,uid:int,name:str,merge_mode:int=1,edit_metadata=False) -> None:

def get(self):
cur = getUserMergeSettings(self.user_id)
if cur is not None:
self.name = cur["name"]
self.merge_mode = cur["user_settings"]["merge_mode"]
self.edit_metadata = cur["user_settings"]["edit_metadata"]
self.allowed = cur["isAllowed"]
self.thumbnail = cur["thumbnail"]
self.banned = cur["isBanned"]
return {
"uid": self.user_id,
"name": self.name,
"user_settings": {
"merge_mode": self.merge_mode,
"edit_metadata": self.edit_metadata,
},
"isAllowed": self.allowed,
"isBanned": self.banned,
"thumbnail": self.thumbnail,
}
else: return self.set()
try:
cur = getUserMergeSettings(self.user_id)
if cur is not None:
self.name = cur["name"]
self.merge_mode = cur["user_settings"]["merge_mode"]
self.edit_metadata = cur["user_settings"]["edit_metadata"]
self.allowed = cur["isAllowed"]
self.thumbnail = cur["thumbnail"]
self.banned = cur["isBanned"]
return {
"uid": self.user_id,
"name": self.name,
"user_settings": {
"merge_mode": self.merge_mode,
"edit_metadata": self.edit_metadata,
},
"isAllowed": self.allowed,
"isBanned": self.banned,
"thumbnail": self.thumbnail,
}
else: return self.set()
except KeyError:
return self.set()

def set(self):
setUserMergeSettings(
Expand Down

0 comments on commit cb86fb1

Please sign in to comment.