fix sorting
This commit is contained in:
parent
4287c6c5d6
commit
5486bb9114
1 changed files with 3 additions and 3 deletions
|
@ -104,10 +104,10 @@ def validate_color(color: str) -> bool:
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def sort_list(l: list[list[str]], alphabetical=True) -> list[list[str]]:
|
def sort_list(l: list[list[str]], alphabetical=False) -> list[list[str]]:
|
||||||
output = []
|
output = []
|
||||||
for i in l:
|
for i in l:
|
||||||
if i[0] and (not alphabetical and (i[1] in ["1", "2", "3", "4"]) or (alphabetical and i[1])):
|
if i[0] and ((not alphabetical and (i[1] in ["1", "2", "3", "4"]) or (alphabetical and i[1]))):
|
||||||
output.append(i)
|
output.append(i)
|
||||||
|
|
||||||
if alphabetical:
|
if alphabetical:
|
||||||
|
@ -533,7 +533,7 @@ def api_save():
|
||||||
for i in x["social"]:
|
for i in x["social"]:
|
||||||
if len(i) == 2 and i[1] in SOCIALS_REGEX and SOCIALS_REGEX[i[1]].match(i[0]):
|
if len(i) == 2 and i[1] in SOCIALS_REGEX and SOCIALS_REGEX[i[1]].match(i[0]):
|
||||||
social.append(i)
|
social.append(i)
|
||||||
user_data["social"] = sort_list(social)
|
user_data["social"] = sort_list(social, True)
|
||||||
|
|
||||||
f = open(f"{SAVING_DIRECTORY}{username}.json", "w")
|
f = open(f"{SAVING_DIRECTORY}{username}.json", "w")
|
||||||
f.write(json.dumps(user_data))
|
f.write(json.dumps(user_data))
|
||||||
|
|
Loading…
Reference in a new issue