Project

General

Profile

difference between author_id and user_id in time_entries

Added by allan cg over 2 years ago

Hello,

I am extracting data from redmine database, and I would like to understand the difference between the fields author_id and user_id in the time_entries table. They are 100% equal in my instance, but I only do basic stuff. So I would like to understand how can those fields differ to avoid possible missinformation in the future.


Replies (4)

RE: difference between author_id and user_id in time_entries - Added by Holger Just over 2 years ago

The author_id refers to the user who created the time entry. This is always the currently logged in user when the time entry is created.

The user_id refers to the user who the time entry is attributed to, that is, usually the user who has actually used up the time logged there.

The two values are different if a user logs time for a different user, i.e. if an admin logs a time entry for a project member. Here, the author_id will refer to the administrator, but the user_id refers to the project member.

RE: difference between author_id and user_id in time_entries - Added by Mischa The Evil over 2 years ago

FWIW:

Easy but semantically-incorrect, but still useful reminder I use:
  • User:
    • refers to the person who spent the time that is 'logged/booked/recorded/authored' in Redmine
  • Author:
    • refers to the person who 'logged/booked/recorded/authored' the time that is spent in Redmine

Holger Just wrote:

[...] i.e. if an admin logs a time entry for a project member. Here, the author_id will refer to the administrator, but the user_id refers to the project member.

To be near-pedantically precise: it doesn't have to be a user that is a Redmine administrator. It (also?) applies to users who have a role that grants the 'Log spent time for other users' permission on the particular project.

Ref.: #3848.

RE: difference between author_id and user_id in time_entries - Added by Holger Just over 2 years ago

yeah, a less confusing term in my example would have been to use "manager" instead of "admin". You are correct that any user who has the permission to "Log spent time for other users" (that is: all actual Redmine admins as well as any user with an appropriate role in the project) can log time for other users which might result in different values in the author_id and user_id columns.

RE: difference between author_id and user_id in time_entries - Added by allan cg over 2 years ago

Hello again, thank you for the answers. There is any of type of reference guide where I could learn about definitions for tables, fields and such? Since I am extracting mostly all tables for further data analysis, I will likely found more issues trying to identify what some fields represent.

allan

    (1-4/4)