From 1ae2df0c7abfe4a3a9f354e5cb664288cbd3bb51 Mon Sep 17 00:00:00 2001 From: Andrea Callia D'Iddio <ac4014@ic.ac.uk> Date: Tue, 28 Feb 2023 23:07:07 +0000 Subject: [PATCH] Fix: fix style with binary operators. --- app/views/staff.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/views/staff.py b/app/views/staff.py index b2c4b84..dfd54fa 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")) -- GitLab