Skip to content

Commit

Permalink
switch from cost center to hr org upon UW Library's request after uwf…
Browse files Browse the repository at this point in the history
…t go live
  • Loading branch information
fanglinfang committed Jun 30, 2023
1 parent e79dbcf commit 44141ba
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 21 deletions.
8 changes: 4 additions & 4 deletions uw_hrp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def __str__(self):


class EmploymentDetails(models.Model):
budget_code = models.CharField(max_length=16, default="")
start_date = models.DateTimeField(null=True, default=None)
end_date = models.DateTimeField(null=True, default=None)
hr_org = models.CharField(max_length=96, default="")
job_class = models.CharField(max_length=128, null=True, default=None)
job_title = models.CharField(max_length=128, null=True, default=None)
is_primary = models.BooleanField(default=False)
Expand All @@ -123,7 +123,7 @@ class EmploymentDetails(models.Model):

def to_json(self):
data = {
'budget_code': self.budget_code,
'hr_org': self.hr_org,
'end_date': date_to_str(self.end_date),
'is_primary': self.is_primary,
'job_title': self.job_title,
Expand Down Expand Up @@ -173,8 +173,8 @@ def __init__(self, *args, **kwargs):
if (org_det.get("Organization") is not None and
org_det["Organization"].get("Name") is not None and
org_det.get("Type") is not None and
org_det["Type"].get("Name") == "Cost Center"):
self.budget_code = org_det["Organization"]["Name"]
org_det["Type"].get("Name") == "HR Org"):
self.hr_org = org_det["Organization"]["Name"]

if data.get("PositionWorkerType") is not None:
self.pos_type = data["PositionWorkerType"].get("Name")
Expand Down
34 changes: 34 additions & 0 deletions uw_hrp/resources/hrpws/file/hrp/v3/person/000000005.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,40 @@
}
]
}
},
{
"Type": {
"Name": "HR Org",
"WID": "87c9ff9a8b111001721d949632ca0000",
"IDs": [
{
"Type": "WID",
"Value": "87c9ff9a8b111001721d949632ca0000"
},
{
"Type": "Organization_Type_ID",
"Value": "HR_ORG"
}
]
},
"Organization": {
"Name": "Family Medicine",
"WID": "990283877b661001ba2b7654f95d0000",
"IDs": [
{
"Type": "WID",
"Value": "990283877b661001ba2b7654f95d0000"
},
{
"Type": "Organization_Reference_ID",
"Value": "HROrg000733"
},
{
"Type": "Custom_Organization_Reference_ID",
"Value": "HROrg000733"
}
]
}
}
],
"JobScheduledWeeklyHours": 0.0,
Expand Down
34 changes: 34 additions & 0 deletions uw_hrp/resources/hrpws/file/hrp/v3/person/faculty.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,40 @@
}
]
}
},
{
"Type": {
"Name": "HR Org",
"WID": "87c9ff9a8b111001721d949632ca0000",
"IDs": [
{
"Type": "WID",
"Value": "87c9ff9a8b111001721d949632ca0000"
},
{
"Type": "Organization_Type_ID",
"Value": "HR_ORG"
}
]
},
"Organization": {
"Name": "Family Medicine",
"WID": "990283877b661001ba2b7654f95d0000",
"IDs": [
{
"Type": "WID",
"Value": "990283877b661001ba2b7654f95d0000"
},
{
"Type": "Organization_Reference_ID",
"Value": "HROrg000733"
},
{
"Type": "Custom_Organization_Reference_ID",
"Value": "HROrg000733"
}
]
}
}
],
"JobScheduledWeeklyHours": 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,40 @@
}
]
}
},
{
"Type": {
"Name": "HR Org",
"WID": "87c9ff9a8b111001721d949632ca0000",
"IDs": [
{
"Type": "WID",
"Value": "87c9ff9a8b111001721d949632ca0000"
},
{
"Type": "Organization_Type_ID",
"Value": "HR_ORG"
}
]
},
"Organization": {
"Name": "Family Medicine",
"WID": "990283877b661001ba2b7654f95d0000",
"IDs": [
{
"Type": "WID",
"Value": "990283877b661001ba2b7654f95d0000"
},
{
"Type": "Organization_Reference_ID",
"Value": "HROrg000733"
},
{
"Type": "Custom_Organization_Reference_ID",
"Value": "HROrg000733"
}
]
}
}
],
"JobScheduledWeeklyHours": 0.0,
Expand Down
4 changes: 2 additions & 2 deletions uw_hrp/tests/test_hrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_get_person_by_netid(self):
self.assertEqual(
position.primary_position.to_json(),
{
'budget_code': '681925 WORKDAY DEFAULT DEPTBG',
'hr_org': 'Family Medicine',
'end_date': None,
'is_primary': True,
'job_class': 'Academic Personnel',
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_get_person_by_regid(self):
self.maxDiff = None
self.assertEqual(
position.other_active_positions[0].to_json(),
{'budget_code': '141614 UNIVERSITY PRESS',
{'hr_org': '',
'end_date': None,
'is_primary': False,
'job_class': 'Undergraduate Student',
Expand Down
20 changes: 5 additions & 15 deletions uw_hrp/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,12 @@ def test_employment_details(self):
"OrganizationDetails": [
{
"Type": {
"Name": "Cost Center"
"Name": "HR Org"
},
"Organization": {
"Name": "141614 UNIVERSITY PRESS",
"IDs": [
{
"Type": "Organization_Reference_ID",
"Value": "141614"
},
{
"Type": "Cost_Center_Reference_ID",
"Value": "141614"
}
]
"Name": "University Libraries and UW Press (Dept)"
}
},
}
],
"SupervisoryOrganization": {
"Name": "SOM: Family Medicine (... (Inherited))",
Expand All @@ -201,7 +191,7 @@ def test_employment_details(self):
self.assertEqual(
emp_details.to_json(),
{
'budget_code': '141614 UNIVERSITY PRESS',
'hr_org': 'University Libraries and UW Press (Dept)',
'end_date': None,
'is_primary': True,
'job_class': 'Academic Personnel',
Expand Down Expand Up @@ -355,7 +345,7 @@ def test_worker(self):
{
'active_positions': [
{
'budget_code': '',
'hr_org': '',
'is_primary': True,
'job_class': None,
'job_profile': {'description': None,
Expand Down

0 comments on commit 44141ba

Please sign in to comment.