diff --git a/app/views/staff.py b/app/views/staff.py
index b2c4b84dc51234049e434a52bd822d1e0db6e8ec..dfd54fa908ad33006fd905eafe9fcf117b69ea3b 100644
--- a/app/views/staff.py
+++ b/app/views/staff.py
@@ -131,10 +131,12 @@ def delete_project(project_id):
         project.category
     ).is_deadline_expired_for_staff:
         flash(messages.DEADLINE_EXPIRED_FOR_STAFF)
-    elif (
-        (project is not None)
-        and (project.category in category_codes)
-        and (project.proposer == current_user.username)
+    elif all(
+        (
+            (project is not None),
+            (project.category in category_codes),
+            (project.proposer == current_user.username),
+        )
     ):
         project.deleted = datetime.utcnow()
         db.session.commit()
@@ -306,16 +308,15 @@ def update_ranking():
     )
     deadline_errors = False
     for shortlisting in current_shortlist:
+        current_ranking = shortlisting.staff_ranking
+        new_ranking = shortlisting_ids.index(shortlisting.id) + 1
         if Category.query.get(
             Project.query.get(shortlisting.project_id).category
         ).is_deadline_expired_for_staff:
-            if (
-                shortlisting.staff_ranking
-                != shortlisting_ids.index(shortlisting.id) + 1
-            ):
+            if current_ranking != new_ranking:
                 deadline_errors = True
         else:
-            shortlisting.staff_ranking = shortlisting_ids.index(shortlisting.id) + 1
+            shortlisting.staff_ranking = new_ranking
     if deadline_errors:
         flash(messages.DEADLINE_EXPIRED_FOR_STAFF)
         return redirect(url_for(f"{current_user.role}.projects"))