Skip to content

Commit 09798ea

Browse files
committed
fix a bug causing current task to reset when updating a passive task
1 parent be44537 commit 09798ea

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

task_database.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,6 @@ def get_taskCurrent_tier(username, tier):
234234

235235

236236
def __set_current_task(username: str, tier: str, task_id: str, current: bool):
237-
# coll = mydb["taskAccounts"]
238-
# coll.update_one(
239-
# {"username": username, "%s._id" % tier: task_id},
240-
# {"$set": {"%s.$.taskCurrent" % tier: current}},
241-
# )
242237
task_coll = mydb["taskLists"]
243238
cleaned_tier = tier.replace("Tasks", "")
244239
if not current:
@@ -255,10 +250,6 @@ def __set_current_task(username: str, tier: str, task_id: str, current: bool):
255250

256251

257252
def __set_task_complete(username: str, tier: str, task_id: int, complete: bool):
258-
# coll = mydb['taskAccounts']
259-
# coll.update_one({'username': username, '%s._id' % tier: task_id},
260-
# {'$set': {'%s.$.status' % tier: 'Complete' if complete else 'Incomplete',
261-
# '%s.$.taskCurrent' % tier: False}})
262253
task_coll = mydb['taskLists']
263254
cleaned_tier = tier.replace("Tasks", "")
264255
if complete:
@@ -267,10 +258,7 @@ def __set_task_complete(username: str, tier: str, task_id: int, complete: bool):
267258
{
268259
"$push": {
269260
f"tiers.{cleaned_tier}.completedTasks": {"taskId": task_id}
270-
},
271-
"$unset": {
272-
f"tiers.{cleaned_tier}.currentTask": ""
273-
}
261+
}
274262
}
275263
)
276264
if not complete:

0 commit comments

Comments
 (0)