[sysadmin-bin] inactive-gitlab-users.py: Improve inactivity check



commit 44765f11b2ace70abb11bc422c58308965490237
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Mon Jul 22 15:06:46 2019 +0200

    inactive-gitlab-users.py: Improve inactivity check

 gitlab/inactive-gitlab-users.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gitlab/inactive-gitlab-users.py b/gitlab/inactive-gitlab-users.py
index e9986a6..2b63a64 100755
--- a/gitlab/inactive-gitlab-users.py
+++ b/gitlab/inactive-gitlab-users.py
@@ -97,9 +97,12 @@ def get_inactive_users(gl, timedelta_unit, timedelta_value):
 
         created_at = timestamp2date(attrs["created_at"])
         current_sign_in_at = timestamp2date(attrs["current_sign_in_at"])
+        last_activity_on = timestamp2date(attrs["last_activity_on"])
 
         # If user logged in only once or never, check if they made any action.
-        if (created_at == current_sign_in_at) or (not current_sign_in_at):
+        if (created_at == current_sign_in_at == last_activity_on) or not (
+            current_sign_in_at or last_activity_on
+        ):
             events = user.events.list(all=True)
             if len(events) == 0:
                 userdata['reason'] = "inactivity"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]