Time log notification

How to add time log notification. When artist not update time log. How he get notification. Can you help coding.

We have a thing like this, but it is not too simple to organize.

  • We have a cron job that runs daily.
  • It gets the set of all active users, and the set of users that logged time for this day.
  • It takes the difference in the two sets.
  • Creates a note with the resulting set.

Here is the bit of code that performs the calculation to get users without timelog:

timelog_fields = [
    "created_at",
    "description",
    "duration",
    "project",
    "entity",
    "entity.Task.entity",
    "user",
    "user.HumanUser.login"
]

def get_timelog_last_day(sg):
    return sg.find(
        "TimeLog",
        [["created_at", "in_last", 1, "DAY"]],
        timelog_fields
    )

def get_active_users(sg):
    return sg.find(
        "HumanUser",
        [["sg_status_list", "is", "act"],
         ["department", "is_not", None]],
        ["login", "name"]
    )

def get_users_without_timelog_today(sg):
    logged_today_logins = [u["user.HumanUser.login"]
                           for u in get_timelog_last_day(sg)]
    active_users = get_active_users(sg)
    missing_users = [u for u in active_users if u["login"] not in logged_today_logins]
    return missing_users

1 Like

Hey @mmoshev Your script was so useful . Disclaimer: I am very new to the scripting in python or scripting as such . I am good in using shotgun and its features with the admin managing . What I wanted to do is send a notification to the artists who have missed their timelogs alone on a daily basis. Is there a way to do that?