Skip to content

Commit

Permalink
Eliminate some more unsynchronized changes to the run object.
Browse files Browse the repository at this point in the history
  • Loading branch information
vdbergh committed Jan 25, 2025
1 parent c3e8210 commit 4702477
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions server/fishtest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,7 @@ def tests_modify(request):
request.session.flash("Unable to modify another user's run!", "error")
return home(request)

run_id = run["_id"]
is_approver = request.has_permission("approve_run")
if (
not is_approver
Expand All @@ -1262,20 +1263,22 @@ def tests_modify(request):
)
):
request.actiondb.approve_run(username=userid, run=run, message="unapproved")
run["approved"] = False
run["approver"] = ""
with request.rundb.active_run_lock(run_id):
run["approved"] = False
run["approver"] = ""

before = del_tasks(run)
run["args"]["num_games"] = int(request.POST["num-games"])
run["args"]["priority"] = int(request.POST["priority"])
run["args"]["throughput"] = int(request.POST["throughput"])
run["args"]["auto_purge"] = True if request.POST.get("auto_purge") else False
if (
is_same_user(request, run)
and "info" in request.POST
and request.POST["info"].strip() != ""
):
run["args"]["info"] = request.POST["info"].strip()
with request.rundb.active_run_lock(run_id):
run["args"]["num_games"] = int(request.POST["num-games"])
run["args"]["priority"] = int(request.POST["priority"])
run["args"]["throughput"] = int(request.POST["throughput"])
run["args"]["auto_purge"] = True if request.POST.get("auto_purge") else False
if (
is_same_user(request, run)
and "info" in request.POST
and request.POST["info"].strip() != ""
):
run["args"]["info"] = request.POST["info"].strip()
request.rundb.set_active_run(run)

after = del_tasks(run)
Expand Down Expand Up @@ -1304,7 +1307,7 @@ def tests_modify(request):
if run["approved"]:
cached_flash(request, "Run successfully modified!")
else:
cached_flash(request, "Run successfully modified!, please wait for approval.")
cached_flash(request, "Run successfully modified! Please wait for approval.")
return home(request)


Expand Down

0 comments on commit 4702477

Please sign in to comment.