Skip to content

Commit

Permalink
Add weekly working hours field for users (#1495)
Browse files Browse the repository at this point in the history
* Add weekly working hours field for users

* Fix tests

* remove default value
  • Loading branch information
Ashesh3 authored Aug 3, 2023
1 parent 19b63d2 commit 01b7269
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions care/users/api/serializers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ class Meta:
"doctor_medical_council_registration",
"created_by",
"home_facility",
"weekly_working_hours",
"local_body",
"district",
"state",
Expand Down Expand Up @@ -398,6 +399,7 @@ class Meta:
"doctor_qualification",
"doctor_experience_commenced_on",
"doctor_medical_council_registration",
"weekly_working_hours",
"created_by",
"last_login",
"home_facility_object",
Expand Down
25 changes: 25 additions & 0 deletions care/users/migrations/0006_user_weekly_working_hours.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.2 on 2023-08-02 04:39

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("users", "0005_alter_user_alt_phone_number_alter_user_phone_number"),
]

operations = [
migrations.AddField(
model_name="user",
name="weekly_working_hours",
field=models.IntegerField(
blank=True,
null=True,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(168),
],
),
),
]
3 changes: 3 additions & 0 deletions care/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ class User(AbstractUser):
home_facility = models.ForeignKey(
"facility.Facility", on_delete=models.PROTECT, null=True, blank=True
)
weekly_working_hours = models.IntegerField(
validators=[MinValueValidator(0), MaxValueValidator(168)], null=True, blank=True
)

doctor_qualification = models.TextField(
blank=False,
Expand Down
1 change: 1 addition & 0 deletions care/users/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get_detail_representation(self, obj=None) -> dict:
"doctor_experience_commenced_on": obj.doctor_experience_commenced_on,
"doctor_medical_council_registration": obj.doctor_medical_council_registration,
"doctor_qualification": obj.doctor_qualification,
"weekly_working_hours": obj.weekly_working_hours,
**self.get_local_body_district_state_representation(obj),
}

Expand Down

0 comments on commit 01b7269

Please sign in to comment.