# Time log notification

**URL:** <https://community.shotgridsoftware.com/t/time-log-notification/15040>\
**Category:** Pipeline Integrations\
**Tags:** fptr-tk, python-api, fptr-webapp, release-notes\
**Created:** [March 27, 2022, 2:37pm UTC](https://community.shotgridsoftware.com/t/time-log-notification/15040 "2022-03-27T14:37:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dillip](https://avatars.discourse-cdn.com/v4/letter/d/fbc32d/32.png) [@dillip](https://community.shotgridsoftware.com/u/dillip)\
**Post date:** [March 27, 2022, 2:37pm UTC](https://community.shotgridsoftware.com/t/time-log-notification/15040/1 "2022-03-27T14:37:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mmoshev](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/mmoshev/32/476_2.png) [@mmoshev](https://community.shotgridsoftware.com/u/mmoshev)\
**Post date:** [March 28, 2022, 7:16am UTC](https://community.shotgridsoftware.com/t/time-log-notification/15040/2 "2022-03-28T07:16:10Z")

</div>

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:

```python
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

```

---

<div class="post-metadata">

**Author:** ![Sriranjani](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@Sriranjani](https://community.shotgridsoftware.com/u/Sriranjani)\
**Post date:** [December 6, 2022, 3:19pm UTC](https://community.shotgridsoftware.com/t/time-log-notification/15040/4 "2022-12-06T15:19:00Z")

</div>

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?
