-
Notifications
You must be signed in to change notification settings - Fork 297
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: Add rolling users validation for oncall shift API #5050
Conversation
3f6219b
to
a74bb03
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 👍 thanks for patch @ravishankar15! 🙂
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.
Makes sense to me 👍
Minor suggestions added.
if not self.db_verification: | ||
return users | ||
|
||
for d in data: |
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.
Would this check be equivalent to do something like
len(set(data)) == users.count()
(ie. make sure we have a user per provided ppk)? I guess you could do a set difference to get the missing users too?
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.
I have Made the changes accordingly
@@ -29,7 +29,7 @@ class OnCallShiftSerializer(EagerLoadingMixin, serializers.ModelSerializer): | |||
allow_null=True, | |||
required=False, | |||
child=UsersFilteredByOrganizationField( | |||
queryset=User.objects, required=False, allow_null=True | |||
queryset=User.objects, db_verification=True, required=False, allow_null=True |
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.
I would suggest a different name for the param, based on my understanding of the check (see also the comment below), eg. require_all_exist
?
What this PR does
Adds validation for rolling users param in the shift api
Which issue(s) this PR closes
Closes 5041
Checklist
pr:no public docs
PR label added if not required)release:
). These labels dictate how your PR willshow up in the autogenerated release notes.