Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Improved asset bed relations for camera preset #2387
Improved asset bed relations for camera preset #2387
Changes from 22 commits
ce02ab6
9be89c9
78750d0
fc04420
ae7dfee
acd2c8e
0560415
e296e21
6da45bf
e5041ce
0a199fb
d5b24ec
b27b7e9
a90848f
aee281a
a971edd
a49350d
2375ecd
8042a7f
55b9eb8
3aa52e8
a6049ff
fc41114
1370725
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 30 in care/facility/api/serializers/camera_preset.py
Codecov / codecov/patch
care/facility/api/serializers/camera_preset.py#L30
Check warning on line 40 in care/facility/api/serializers/camera_preset.py
Codecov / codecov/patch
care/facility/api/serializers/camera_preset.py#L38-L40
Check warning on line 45 in care/facility/api/serializers/camera_preset.py
Codecov / codecov/patch
care/facility/api/serializers/camera_preset.py#L43-L45
Check warning on line 49 in care/facility/api/serializers/camera_preset.py
Codecov / codecov/patch
care/facility/api/serializers/camera_preset.py#L48-L49
Check warning on line 159 in care/facility/api/viewsets/bed.py
Codecov / codecov/patch
care/facility/api/viewsets/bed.py#L159
Check warning on line 192 in care/facility/api/viewsets/bed.py
Codecov / codecov/patch
care/facility/api/viewsets/bed.py#L192
Check warning on line 25 in care/facility/api/viewsets/camera_preset.py
Codecov / codecov/patch
care/facility/api/viewsets/camera_preset.py#L25
Check warning on line 28 in care/facility/api/viewsets/camera_preset.py
Codecov / codecov/patch
care/facility/api/viewsets/camera_preset.py#L28
Check warning on line 31 in care/facility/api/viewsets/camera_preset.py
Codecov / codecov/patch
care/facility/api/viewsets/camera_preset.py#L31
Check warning on line 36 in care/facility/api/viewsets/camera_preset.py
Codecov / codecov/patch
care/facility/api/viewsets/camera_preset.py#L34-L36
Check warning on line 49 in care/facility/api/viewsets/camera_preset.py
Codecov / codecov/patch
care/facility/api/viewsets/camera_preset.py#L48-L49
Check warning on line 53 in care/facility/api/viewsets/camera_preset.py
Codecov / codecov/patch
care/facility/api/viewsets/camera_preset.py#L52-L53
Check warning on line 56 in care/facility/api/viewsets/camera_preset.py
Codecov / codecov/patch
care/facility/api/viewsets/camera_preset.py#L56
Check warning on line 58 in care/facility/api/viewsets/camera_preset.py
Codecov / codecov/patch
care/facility/api/viewsets/camera_preset.py#L58
Check warning on line 63 in care/facility/api/viewsets/camera_preset.py
Codecov / codecov/patch
care/facility/api/viewsets/camera_preset.py#L62-L63
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.
Do we have that many assetbed realtions in prod right now ?
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.
Why is 1 so special ?
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.
We need to preserve the first asset-bed link since the camera preset would be associated to the asset-bed link. So far each old preset had it's own asset-bed record. However, asset-bed records would be now unique together for asset and bed and the newly created preset record would be linked to this asset bed, hence we need to preserve the first asset-bed.
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.
Migrations usually delete data later on, deleting data right away is usually not the best approach.
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.
Will remove it from this PR and create separate PR to remove it.
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.
The duplicate asset-bed records would have to be marked as deleted for the unique constraint to be applied, and for the front-end to know which asset-bed record to link to when the preset is being created.
We can however skip deleting the meta data from these old records so that data is still preserved, just that duplicate asset-bed link records would no longer be accessible by the viewset.