Skip to content

Commit

Permalink
FIX order of access for sqlalchemy repo object
Browse files Browse the repository at this point in the history
  • Loading branch information
wabscale committed Mar 15, 2024
1 parent 62cc145 commit 3691c3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/anubis/views/admin/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,20 @@ def admin_repos_delete(repo_id: str):
assert_course_context(assignment)
assert_course_context(student)


# If the repo is shared, then student can not delete
req_assert(not repo.shared, message="Repo is shared. Please reach out to Anubis support to delete/reset this repo.")

# save this now, or get a database error after the delete operation
assignment_id = repo.assignment_id

# Delete the repo
delete_assignment_repo(student, assignment)

# Delete cache entry
cache.delete_memoized(get_repos, student.id)

# Clear cache entry
cache.delete_memoized(get_assignment_data, student.id, repo.assignment_id)
cache.delete_memoized(get_assignment_data, student.id, assignment_id)

# Pass them back
return success_response({"status": "Github Repo & Submissions deleted"})

0 comments on commit 3691c3e

Please sign in to comment.