-
Notifications
You must be signed in to change notification settings - Fork 268
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
Add serializer constraints to AssetBed #1018
Add serializer constraints to AssetBed #1018
Conversation
* HL7Monitor Assets can have only 1 Bed Associated with it. * Assets that are neither HL7Monitor nor ONVIFCamera should not have Bed Relations
Kudos, SonarCloud Quality Gate passed!
|
Codecov Report
@@ Coverage Diff @@
## master #1018 +/- ##
==========================================
- Coverage 54.02% 53.78% -0.25%
==========================================
Files 182 180 -2
Lines 8990 8921 -69
Branches 0 1523 +1523
==========================================
- Hits 4857 4798 -59
+ Misses 4133 4074 -59
- Partials 0 49 +49
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@Krishna-Sivakumar Make sure that you specify the issue you're solving |
elif ( | ||
asset.asset_class != "HL7MONITOR" | ||
and asset.asset_class != "ONVIF" | ||
and asset.bed_set.all().count() > 0 |
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.
Not really sure why this condition is here.
@@ -82,6 +82,23 @@ def validate(self, attrs): | |||
raise ValidationError( | |||
{"asset": "Should be in the same facility as the bed"} | |||
) | |||
|
|||
if asset.asset_class == "HL7MONITOR" and asset.bed_set.all().count() > 1: |
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.
shouldn't we also check for = 1 as well ?
Fixes issue #934
Proposed Changes
AssetBed Serializer was updated to validate the following constraints:
@coronasafe/code-reviewers
Merge Checklist