From d186728526631f48621d8eea5073090214ed6fce Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Fri, 22 Nov 2019 09:50:26 -0500 Subject: [PATCH] Change order of if/elif statement for ApplicationRole display_status Since an invite that is expired has a status of 'pending', the ordering of the if/elif statement needs to be switched so it checks to see if the invite is expired before seeing if it is pending. --- atst/models/application_role.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/atst/models/application_role.py b/atst/models/application_role.py index 12c7a9c3..f8f7f201 100644 --- a/atst/models/application_role.py +++ b/atst/models/application_role.py @@ -113,19 +113,17 @@ class ApplicationRole( @property def display_status(self): if ( - self.is_pending - and self.latest_invitation - and self.latest_invitation.is_pending - ): - return "invite_pending" - - elif ( self.is_pending and self.latest_invitation and self.latest_invitation.is_expired ): return "invite_expired" - + elif ( + self.is_pending + and self.latest_invitation + and self.latest_invitation.is_pending + ): + return "invite_pending" elif self.is_active and any( env_role.is_pending for env_role in self.environment_roles ):