Skip to content

Commit

Permalink
changed indendation for linter test
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-sharmav committed Nov 5, 2024
1 parent fdf75a0 commit 639aab7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions care/facility/api/serializers/prescription.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

from django.shortcuts import get_object_or_404
from django.utils import timezone
from rest_framework import serializers
Expand All @@ -9,7 +11,6 @@
PrescriptionDosageType,
)
from care.users.api.serializers.user import UserBaseMinimumSerializer
import re


class MedibaseMedicineSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -100,8 +101,9 @@ class Meta:

def validate(self, attrs):
def extract_numeric_value(dosage):

match = re.match(r"(\d+(\.\d+)?)", dosage) # Matches digits and optional decimal part
match = re.match(
r"(\d+(\.\d+)?)", dosage
) # Matches digits and optional decimal part
if match:
return float(match.group(1))
return None
Expand Down Expand Up @@ -147,7 +149,9 @@ def extract_numeric_value(dosage):
# Raise error if max_dosage is less than base_dosage
if max_dosage_value < base_dosage_value:
raise serializers.ValidationError(
{"max_dosage": "Max dosage in 24 hours should be greater than or equal to base dosage."}
{
"max_dosage": "Max dosage in 24 hours should be greater than or equal to base dosage."
}
)

if attrs.get("dosage_type") == PrescriptionDosageType.PRN:
Expand Down
2 changes: 1 addition & 1 deletion care/facility/tests/test_prescriptions_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,5 @@ def test_max_dosage_less_than_base_dosage(self):
self.assertIn("max_dosage", response.data)
self.assertEqual(
response.data["max_dosage"][0],
"Max dosage in 24 hours should be greater than or equal to base dosage."
"Max dosage in 24 hours should be greater than or equal to base dosage.",
)

0 comments on commit 639aab7

Please sign in to comment.