How could I check no upload timelog person?(Is it possible to check didn't update person in Shotgrid)?

Hi, guys

I’m working at the film company.
My company started time log these weeks.
we just want to check how didn’t upload(update) time log every day.
but I don’t know how can I sort this. if you know plz let me give your idea or way.
and is it possible to check no daily(version) person too?

Thank you
kim

Hi Ki,
This looks to be tricky to set up.
The best I could do is to create a new query field for your “person” entities.
You would query time logs for Person==Current Person, and then Date in the last x days. Then show the “summary of” Duration “caclulated by” “Sum”.
This gets you the amount of time logged per user in the last x days.
I thought you might then be able to filter your “Person” view by this value, but it appears that SG doesn’t support filtering(or sorting for that matter) by query fields… so you’ll be left to either manually looking through the values for artists with no time logged, or by setting up a SG event daemon to do the calculation and store the value in a custom float fields that you would be able to sort/filter by.

Hi, Patrick
Thank you for the reply.
I tried to your advice. but how can I choose the current Person?

it should default, but if not, then type your name in and in the drop down it will have “Current Person” next to your name, select that one.

This might actually be a nice feature request, because it seems frequently needed.
We do this with a script

  • get all timelogs for the given day (yesterday) (p1)
  • get all active people (p2)
  • get difference p2 - p1

I can share some parts of the code if you would find it useful.

1 Like

ohhhhh!!! WOOOOOOOOOOOOOW

That’s really nice.

Could I get that code?
Thank you Mmoshev

Sure, here it is

def get_timelog_last_day(sg):
    return sg.find(
        "TimeLog",
        [["created_at", "in_last", 1, "DAY"]],
        [
            "created_at",
            "description",
            "duration",
            "project",
            "entity",
            "entity.Task.entity",
            "user",
            "user.HumanUser.login"
        ]
    )


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

The missing_users list comprehension is the thing that performs the “subtraction”.

So you just call get_users_without_timelog_today and decide whether to print this somewhere, store it in shotgun, or whatever. We also automatically create timelogs based on this data.

Edit: This returns users without logs from yesterday. Change the filter in get_timelog_last_day to get what you need.

1 Like