-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(2989) Return users field data for web overriden shifts via public… #3303
fix(2989) Return users field data for web overriden shifts via public… #3303
Conversation
6307e1e
to
b60e38c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes make sense, added a few suggestions. Thanks!
**data, | ||
) | ||
on_call_shift.add_rolling_users([[other_user]]) | ||
on_call_shift.users.add(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When creating override shifts, the users
field should be empty. We only expect rolling_users
to be set up in this case.
and result["rolling_users"] is not None | ||
): | ||
result["users"] += [u for r in result["rolling_users"] for u in r] | ||
result["users"] = list(set(result["users"])) # return unique users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be simplified a bit?
result["users"] = list({u for r in result["rolling_users"] for u in r})
b60e38c
to
d53f3c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one last comment.
And also, would you add an entry to the changelog about this update? Thanks!
"start": on_call_shift.start.strftime("%Y-%m-%dT%H:%M:%S"), | ||
"rotation_start": on_call_shift.start.strftime("%Y-%m-%dT%H:%M:%S"), | ||
"duration": int(on_call_shift.duration.total_seconds()), | ||
"users": list({user.public_primary_key, other_user.public_primary_key}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this may return users in any order, and then the test may randomly fail. It will be nice to make the test stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have made it to use one user to avoid adding unnecessary sort function in the actual code.
08cacf0
to
42fa929
Compare
42fa929
to
d21a02a
Compare
What this PR does
The
rolling_users
field for the shift of type override created from web UI is populated in theusers
field of the public GET Shift APIWhich issue(s) this PR fixes
#2989
Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)