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?
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.
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.