-
Notifications
You must be signed in to change notification settings - Fork 331
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
Scheduling Validations #2701
Scheduling Validations #2701
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 5.1.3 on 2025-01-03 10:23 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("emr", "0060_alter_medicationrequest_dosage_instruction"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name="schedulableuserresource", | ||
old_name="resource", | ||
new_name="user", | ||
), | ||
migrations.AlterField( | ||
model_name="medicationrequest", | ||
name="dosage_instruction", | ||
field=models.JSONField(blank=True, default=list, null=True), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,9 +36,9 @@ def perform_extra_deserialization(self, is_update, obj): | |
if not is_update: | ||
resource = None | ||
try: | ||
user_resource = User.objects.get(external_id=self.resource) | ||
user = User.objects.get(external_id=self.resource) | ||
resource = SchedulableUserResource.objects.get( | ||
resource=user_resource, | ||
user=user, | ||
Comment on lines
+39
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Clarify naming to avoid mixing "resource" and "user". The parameter |
||
facility=Facility.objects.get(external_id=self.facility), | ||
) | ||
obj.resource = resource | ||
|
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.
🛠️ Refactor suggestion
Remove redundant check after
get_object_or_404
get_object_or_404
already handles the not-found scenario, so the manualif not user
check right below is never reached.