Remove recovery from patient disease status#541
Remove recovery from patient disease status#541divyagar wants to merge 1 commit intoohcnetwork:masterfrom divyagar:disease_status
Conversation
| name='disease_status', | ||
| field=models.IntegerField(blank=True, choices=[(1, 'SUSPECTED'), (2, 'POSITIVE'), (3, 'NEGATIVE'), (4, 'RECOVERED'), (5, 'EXPIRED')], default=1, verbose_name='Disease Status'), | ||
| ), | ||
| migrations.AlterField( |
There was a problem hiding this comment.
Similar blocks of code found in 2 locations. Consider refactoring.
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( |
There was a problem hiding this comment.
Similar blocks of code found in 2 locations. Consider refactoring.
| from care.facility.models.patient import PatientRegistration | ||
|
|
||
|
|
||
| def change_disease_status(prev, new, qs): |
There was a problem hiding this comment.
Function change_disease_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
care/facility/models/patient_base.py
Outdated
| RECOVERED = 5 | ||
| EXPIRED = 6 | ||
| RECOVERED = 4 | ||
| EXPIRED = 5 |
There was a problem hiding this comment.
Never use an old choice integer for something else, use another integer
| print(patient.disease_status) | ||
| return failed | ||
|
|
||
|
|
There was a problem hiding this comment.
we can just do patient.filter(disease_status=5).update(disease_status=4) right ?
There was a problem hiding this comment.
we can just do patient.filter(disease_status=5).update(disease_status=4) right ?
Yes we can but then we will not know updation of which rows are failed.
There was a problem hiding this comment.
there will be one single mysql query, what failure are we talking about here ?
| print(patient.disease_status) | ||
| return failed | ||
|
|
||
|
|
There was a problem hiding this comment.
there will be one single mysql query, what failure are we talking about here ?
|
Hey @vigneshhari, I think this change to 'RECOVERY' to If you agree, I can do that and then this one only needs to handle the addition of another value to the model. |
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( |
There was a problem hiding this comment.
Similar blocks of code found in 2 locations. Consider refactoring.
| name='disease_status', | ||
| field=models.IntegerField(blank=True, choices=[(1, 'SUSPECTED'), (2, 'POSITIVE'), (3, 'NEGATIVE'), (5, 'RECOVERED'), (6, 'EXPIRED')], default=1, verbose_name='Disease Status'), | ||
| ), | ||
| migrations.AlterField( |
There was a problem hiding this comment.
Similar blocks of code found in 2 locations. Consider refactoring.
|
Code Climate has analyzed commit 783270f and detected 2 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
|
Kudos, SonarCloud Quality Gate passed!
|
|
@abhiabhi94 you can take over this issue then, @divyagar after he is done with his work review it. |
|
@abhiabhi94 close this PR when you start working on the issue |
|
|
|
ohcnetwork/care_fe#988 |
Please check this issue for information.