Skip to content
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

Fixed: Added in_use field to track used bed #939

Closed
wants to merge 4 commits into from

Conversation

aeswibon
Copy link
Member

Updates

  • Fixes Issue: In Use beds present in bedList #936
  • Added in_use field to Bed model to track used bed
  • Added migration function to update in_use field for previous bed models
  • Updated serializer to update in_use field during bed update

@aeswibon aeswibon requested a review from a team as a code owner July 23, 2022 03:47
@sonarcloud
Copy link

sonarcloud bot commented Jul 23, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov-commenter
Copy link

Codecov Report

Merging #939 (88f3109) into master (9730efd) will decrease coverage by 1.43%.
The diff coverage is 22.72%.

@@            Coverage Diff             @@
##           master     #939      +/-   ##
==========================================
- Coverage   54.23%   52.80%   -1.44%     
==========================================
  Files         181      181              
  Lines        8826     8855      +29     
==========================================
- Hits         4787     4676     -111     
- Misses       4039     4179     +140     
Impacted Files Coverage Δ
care/facility/api/serializers/bed.py 39.83% <6.25%> (-0.88%) ⬇️
care/facility/models/bed.py 86.66% <66.66%> (ø)
...e/utils/serializer/phonenumber_ispossible_field.py 50.00% <0.00%> (-43.75%) ⬇️
config/serializers.py 36.84% <0.00%> (-31.58%) ⬇️
care/audit_log/middleware.py 47.36% <0.00%> (-22.81%) ⬇️
care/users/models.py 73.94% <0.00%> (-16.20%) ⬇️
care/facility/models/mixins/permissions/base.py 45.00% <0.00%> (-15.00%) ⬇️
care/users/api/viewsets/users.py 43.50% <0.00%> (-12.34%) ⬇️
care/facility/api/viewsets/facility.py 58.10% <0.00%> (-12.17%) ⬇️
care/users/api/serializers/user.py 56.77% <0.00%> (-9.33%) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9730efd...88f3109. Read the comment docs.

@vigneshhari
Copy link
Member

do we need an in_use attribute ? end_date == None serves the same purpose right?

@aeswibon
Copy link
Member Author

aeswibon commented Jul 26, 2022

@vigneshhari There is an issue coronasafe/care_fe#3216. To fix this issue, I have added in_use field in Bed Model

@vigneshhari
Copy link
Member

@cp-Coder you can use the end_date is null to check if a bed is in use.

@aeswibon
Copy link
Member Author

aeswibon commented Jul 27, 2022

@vigneshhari end_date is present in the ConsultationBed model. In the issue, the user should be able to see only those beds (in the list present in the switch bed form) which are not in use. If the in_use field is not present, then I have to query every bed of that facility in the Bed model(for the list) and in the ConsultationBed model too (to check whether it is still in use or not). This will increase the no of queries to the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue: In Use beds present in bedList
3 participants