-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pop
death_datetime
and death_confirmed_doctor
if discharge reason…
… other than EXPIRED (#1519) * pop `death_datetime` and `death_confirmed_doctor` if discharge reason is not expired * add tests
- Loading branch information
1 parent
1579fe9
commit 1de5ef7
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.2 on 2023-08-07 16:18 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("facility", "0375_alter_dailyround_resp"), | ||
] | ||
|
||
def reset_expired_fields_for_non_expired_discharged_consultations( | ||
apps, schema_editor | ||
): | ||
PatientConsultation = apps.get_model("facility", "PatientConsultation") | ||
PatientConsultation.objects.exclude( | ||
discharge_reason__isnull=True, | ||
discharge_reason="EXP", | ||
).update( | ||
death_datetime=None, | ||
death_confirmed_doctor=None, | ||
) | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
reset_expired_fields_for_non_expired_discharged_consultations, | ||
reverse_code=migrations.RunPython.noop, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters