Skip to content

Commit 37a0b3d

Browse files
committed
task changes 05/13/2025
1 parent 34f7581 commit 37a0b3d

9 files changed

Lines changed: 21913 additions & 6931 deletions

File tree

config.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import base64
44

55
def create_pem_from_base64(base64_string, filename):
6+
# if certificate already exists, return
7+
if os.path.exists(filename):
8+
return
9+
610
decoded_data = base64.b64decode(base64_string)
711

812
# save to file
@@ -23,4 +27,9 @@ def create_pem_from_base64(base64_string, filename):
2327
tls=True,
2428
tlsCertificateKeyFile="certificate.pem")
2529
else:
26-
MONGO_CLIENT = pymongo.MongoClient(MONGO_URL)
30+
if os.path.exists("certificate.pem"):
31+
MONGO_CLIENT = pymongo.MongoClient(MONGO_URL,
32+
tls=True,
33+
tlsCertificateKeyFile="certificate.pem")
34+
else:
35+
MONGO_CLIENT = pymongo.MongoClient(MONGO_URL)

task_database.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import random
2-
import gspread
2+
# import gspread
33
import re
44
from math import floor
55
import tasklists
@@ -25,7 +25,6 @@
2525
2626
'''
2727

28-
2928
def get_user(username) -> UserDatabaseObject:
3029
coll = mydb['taskAccounts']
3130
users = list(coll.find({'username': username}))
@@ -34,8 +33,7 @@ def get_user(username) -> UserDatabaseObject:
3433
old_user_data = users[0]
3534
return convert_database_user(migrate_database_user_to_new_format(old_user_data))
3635

37-
38-
# For new taskList data format - Replaces above after migration
36+
# to replace above function after migration
3937
def get_user_2(username) -> UserDatabaseObject:
4038
coll = mydb['taskLists']
4139
users = list(coll.find({'username': username}))
@@ -343,7 +341,7 @@ def complete_task_unofficial_tier(username: str, task_id: int, tier: str) -> dic
343341
def complete_task(username: str) -> dict:
344342
user = get_user(username)
345343
task_check = user.current_task()
346-
344+
print(task_check)
347345
if task_check is None:
348346
return {}
349347

@@ -1145,4 +1143,5 @@ def to_user(data):
11451143

11461144

11471145
if __name__ == "__main__":
1146+
11481147
pass

taskapp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import tasklists
1010
from task_database import (get_taskCurrent, generate_task, complete_task, get_task_progress,
1111
get_task_lists, manual_complete_tasks, manual_revert_tasks,
12-
import_spreadsheet, uncomplete_all_tasks, lms_status_change,
12+
uncomplete_all_tasks, lms_status_change,
1313
official_status_change, username_change, official_icon, unofficial_icon, get_taskCurrent_tier, generate_task_for_tier,
1414
complete_task_unofficial_tier, get_user, get_leaderboard)
1515
import send_grid_email
@@ -354,6 +354,8 @@ def login():
354354

355355
except Exception as e:
356356
error = "An error occurred while processing your request, please try again."
357+
print(e)
358+
flash(error)
357359
return render_template('loginV2.html')
358360

359361

0 commit comments

Comments
 (0)