Skip to content
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

worker position state url parameter #7

Merged
merged 4 commits into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions uw_hrp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class WorkerPosition(models.Model):
end_date = models.DateTimeField(null=True, default=None)
ecs_job_cla_code_desc = models.CharField(max_length=96,
null=True, default=None)
is_future_date = models.BooleanField(default=False)
is_primary = models.BooleanField(default=False)
location = models.CharField(max_length=96, null=True, default=None)
pos_type = models.CharField(max_length=64, null=True, default=None)
Expand All @@ -129,14 +130,12 @@ class WorkerPosition(models.Model):
def is_active_position(self):
return self.end_date is None or self.end_date > get_now()

def is_future_position(self):
return self.start_date is not None and self.start_date > get_now()

def to_json(self):
data = {'start_date': date_to_str(self.start_date),
'end_date': date_to_str(self.end_date),
'ecs_job_cla_code_desc': self.ecs_job_cla_code_desc,
'fte_percent': self.fte_percent,
'is_future_date': self.is_future_date,
'is_primary': self.is_primary,
'location': self.location,
'pos_type': self.pos_type,
Expand Down Expand Up @@ -169,6 +168,7 @@ def __init__(self, *args, **kwargs):

self.ecs_job_cla_code_desc = \
data.get("EcsJobClassificationCodeDescription")
self.is_future_date = data.get("IsFutureDate")
self.is_primary = data.get("IsPrimaryPosition")
if data.get("Location") is not None:
self.location = data["Location"]["ID"]
Expand Down Expand Up @@ -227,13 +227,14 @@ def __init__(self, *args, **kwargs):
self.employee_status = EmploymentStatus(
data=data.get("WorkerEmploymentStatus"))

if (self.employee_status.is_active and
data.get("WorkerPositions") is not None):
for position in data["WorkerPositions"]:
position = WorkerPosition(data=position)
if position.is_active_position():
if position.is_primary:
self.primary_manager_id = position.supervisor_eid
self.primary_position = position
else:
self.other_active_positions.append(position)
if self.employee_status.is_active:
positions = data.get("WorkerPositions")
if positions is not None and len(positions) > 0:
for position in positions:
position = WorkerPosition(data=position)
if position.is_active_position():
if position.is_primary:
self.primary_manager_id = position.supervisor_eid
self.primary_position = position
else:
self.other_active_positions.append(position)
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
{
"AcademicAppointments":
[{"AcademicAppointmentCompletedDate":"2017-06-22T07:00:00.000Z",
"AcademicAppointmentEndDate":null,
"AcademicAppointmentIdentifierID":"A",
"AcademicAppointmentIdentifierTypeID":"Administrative",
"AcademicAppointmentStartDate":"2017-04-01T07:00:00.000Z",
"AcademicAppointmentState":"Current",
"AcademicAppointmentTitle":"Chair",
"AcademicAppointmentTrackID":"AC-000000015-2",
"AcademicUnitID":"050",
"AcademicUnitName":"Family Medicine",
"AcademicUnitSupervisoryOrganizations":
[{"AcademicUnitID":"050",
"Code":"SOM:",
"CostCenter":
{"Description":"WORKDAY DEFAULT DEPTBG",
"ID":"681925",
"OrganizationCode":"3040111000",
"OrganizationDescription":"FAMILY MEDICINE"},
"Description":"SOM: Family Medicine (Visor, Super1)",
"Href":"\/hrp\/v2\/organization\/SOM_000420.json",
"ID":"SOM_000420",
"Name":"Family Medicine"},
{"AcademicUnitID":"081",
"Code":"SOM:",
"CostCenter":
{"Description":"DOM PAYROLL SUSPENSE",
"ID":"656131",
"OrganizationCode":"3040510019",
"OrganizationDescription":"FINANCE ABC\/DEANS HR"},
"Description":"School of Medicine (Dean, Bill)",
"Href":"\/hrp\/v2\/organization\/SOM_000001.json",
"ID":"SOM_000001",
"Name":"School of Medicine"}
],
"ActualAcademicAppointmentEndDate":null,
"AppointmentPositionID":null,
"PositionSupervisoryOrganization":null,
"PrimaryPositionID":"PN-0000809",
"SuperiorAcademicUnitID":"081"},
{"AcademicAppointmentCompletedDate":"2017-06-22T07:00:00.000Z",
"AcademicAppointmentEndDate":null,
"AcademicAppointmentIdentifierID":"P",
"AcademicAppointmentIdentifierTypeID":"Primary",
"AcademicAppointmentStartDate":"2017-04-01T07:00:00.000Z",
"AcademicAppointmentState":"Current",
"AcademicAppointmentTitle":"Professor",
"AcademicAppointmentTrackID":"AC-000000015-1",
"AcademicUnitID":"050",
"AcademicUnitName":"Family Medicine",
"AcademicUnitSupervisoryOrganizations":
[{"AcademicUnitID":"050",
"Code":"SOM:",
"CostCenter":
{"Description":"WORKDAY DEFAULT DEPTBG",
"ID":"681925",
"OrganizationCode":"3040111000",
"OrganizationDescription":"FAMILY MEDICINE"},
"Description":"SOM: Family Medicine (Visor, Super1)",
"Href":"\/hrp\/v2\/organization\/SOM_000420.json",
"ID":"SOM_000420",
"Name":"Family Medicine"},
{"AcademicUnitID":"081",
"Code":"SOM:",
"CostCenter":
{"Description":"DOM PAYROLL SUSPENSE",
"ID":"656131",
"OrganizationCode":"3040510019",
"OrganizationDescription":"FINANCE ABC\/DEANS HR"},
"Description":"School of Medicine (Dean, Bill)",
"Href":"\/hrp\/v2\/organization\/SOM_000001.json",
"ID":"SOM_000001",
"Name":"School of Medicine"}
],
"ActualAcademicAppointmentEndDate":null,
"AppointmentPositionID":"PN-0000809",
"PositionSupervisoryOrganization":
{"AcademicUnitID":null,
"Code":"SOM:",
"CostCenter":
{"Description":"DOM PAYROLL SUSPENSE",
"ID":"656131",
"OrganizationCode":"3040510019",
"OrganizationDescription":"FINANCE ABC\/DEANS HR"},
"Description":"School of Medicine (Dean, Bill)",
"Href":"\/hrp\/v2\/organization\/SOM_000001.json",
"ID":"SOM_000001",
"Name":"School of Medicine"},
"PrimaryPositionID":"PN-0000809",
"SuperiorAcademicUnitID":"081"}],
"DisplayFirstName":"Super1",
"DisplayLastName":"Visor",
"DisplayMiddleName":null,
"DisplayName":"Super1 Visor",
"EmployeeID":"100000015",
"EmployeeIDPrior":null,
"FormattedLegalNameFirstLast":"Super1 Visor",
"FormattedLegalNameFirstMiddleLast":"Super1 Visor",
"FormattedLegalNameLastFirstMiddle":"Visor, Super1",
"FormattedPreferredNameFirstLast":"Super1 Visor",
"FormattedPreferredNameFirstMiddleLast":"Super1 Visor",
"FormattedPreferredNameLastFirstMiddle":"Visor, Super1",
"HuskyCardOverride":null,
"IsCurrentFaculty":true,
"IsFutureDate":false,
"LegalFirstName":"Super1",
"LegalLastName":"Visor",
"LegalMiddleName":"A",
"LegalNameSuffix":null,
"NetID":"jamespa",
"PreferredFirstName":"Super1",
"PreferredLastName":"Visor",
"PreferredMiddleName":null,
"PreferredNameSuffix":null,
"RegID":"10000000000000000000000000000015",
"RepositoryTimeStamp":"2019-03-06T16:12:12.214Z",
"SystemMetadata":{"LastModified":null},
"WorkdayPersonType":"Employee",
"WorkerContact":
{"Addresses":[
{"Country":"United States of America",
"CountryCodeISO2":"US",
"IsPrimary":true,
"IsPubliclyAvailable":true,
"Lines":["Seattle Main Campus"],
"Municipality":"Seattle",
"PostalCode":"98195",
"Region":"Washington",
"Type":"WORK"},
{"Country":"United States of America",
"CountryCodeISO2":"US",
"IsPrimary":false,
"IsPubliclyAvailable":true,
"Lines":["1705 NE Pacific St"],
"Municipality":"Seattle",
"PostalCode":"98195-0000",
"Region":"Washington",
"Type":"WORK"}],
"CampusBox":"356390",
"EmailAddresses":[
{"Address":"jamespa@uw.edu",
"IsPrimary":true,
"IsPubliclyAvailable":true,
"Type":"WORK"}],
"Phones":[{"AreaCode":"206",
"DeviceType":"Telephone",
"InternationalCode":"1",
"IsPrimary":true,
"IsPubliclyAvailable":true,
"NANPPhoneNumber":"+1 (206) 123-1234",
"Number":"123-1234",
"Type":"WORK"},
{"AreaCode":"206",
"DeviceType":"Telephone",
"InternationalCode":"1",
"IsPrimary":false,
"IsPubliclyAvailable":true,
"NANPPhoneNumber":"+1 (206) 123-1235",
"Number":"123-1235",
"Type":"WORK"}
]
},
"WorkerEmploymentStatus":
{"ActiveStatusDate":"2017-04-01T07:00:00.000Z",
"EmployeeStatus":"Active",
"EmployeeStatusCode":"A",
"EndEmploymentDate":null,
"EstimatedLastDayOfLeave":null,
"FirstDayOfLeave":null,
"FirstDayOfWork":"2017-04-01T07:00:00.000Z",
"HireDate":"2017-04-01T07:00:00.000Z",
"IsActive":true,
"IsRetired":false,
"IsTerminated":false,
"LastDayOfWorkForLeave":null,
"OriginalHireDate":"2017-03-31T07:00:00.000Z",
"RetirementDate":null,
"TerminationDate":null},
"WorkerPositions":[
{"CostCenter":
{"Description":"WORKDAY DEFAULT DEPTBG",
"ID":"681925",
"OrganizationCode":"3040111000",
"OrganizationDescription":"FAMILY MEDICINE"
},
"EcsJobClassificationCode":"F",
"EcsJobClassificationCodeDescription":"Academic Personnel",
"FutureTransactions":[],
"IsFutureDate":false,
"IsMedicalCenterPosition":false,
"IsOnLeaveFromPosition":false,
"IsPrimaryPosition":true,
"JobProfileSummary":
{"Href":"\/hrp\/v2\/jobProfile\/10101.json",
"JobCategory":"Faculty",
"JobFamilies":[
{"JobFamilyID":"Faculty - Indefinite and Multi-Year",
"JobFamilyName":"01 - Academic Personnel - Faculty - Indefinite and Multi-Year",
"JobFamilySummary":"Academic positions designated as faculty under the Faculty Code Chapter 21"}
],
"JobProfileDescription":"Professor",
"JobProfileID":"10101"
},
"Location":
{"ID":"Seattle Campus",
"Name":"Seattle Campus"
},
"ObjectCode":"01",
"PayRateType":"Salary",
"PayrollUnitCode":"00753",
"PlannedDistributions":{},
"PositionBusinessTitle":"Chair",
"PositionEffectiveDate":"2017-04-01T07:00:00.000Z",
"PositionEndDate":null,
"PositionFTEPercent":"100.00000",
"PositionID":"PN-0000809",
"PositionStartDate":"2017-04-01T00:00:00.000Z",
"PositionSupervisor":
{"EmployeeID":"100000115",
"Href":"\/hrp\/v2\/worker\/100000115.json"
},
"PositionTimeTypeID":"Full_time",
"PositionTitle":"PROFESSOR, School of Medicine",
"PositionType":"Regular_Practice_Plan",
"ServicePeriodDescription":"Service_Period_12.00",
"ServicePeriodID":"12",
"SubObjectCode":"10",
"SupervisoryOrganization":
{"AcademicUnitID":null,
"Code":"SOM:",
"CostCenter":
{"Description":"DOM PAYROLL SUSPENSE",
"ID":"656131",
"OrganizationCode":"3040510019",
"OrganizationDescription":"FINANCE ABC\/DEANS HR"
},
"Description":"School of Medicine (Dean, Bill)",
"Href":"\/hrp\/v2\/organization\/SOM_000001.json",
"ID":"SOM_000001",
"Name":"School of Medicine"
},
"TotalBasePayAmount":"0.00000",
"TotalBasePayAnnualizedAmount":"0.00000",
"TotalBasePayFrequency":"Monthly",
"TotalPayAnnualizedAmount":"0.00000",
"WorkShift":"First Shift"
}
]
}
Loading