Skip to content

Commit

Permalink
Fix search
Browse files Browse the repository at this point in the history
  • Loading branch information
fanglinfang committed Dec 20, 2022
1 parent 7c831d6 commit 8d38da6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
6 changes: 0 additions & 6 deletions uw_hrp/models.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from datetime import datetime, timezone
from dateutil.parser import parse
import json
from restclients_core import models


def get_now():
# return time-zone-aware datetime
return datetime.now(timezone.utc)


def date_to_str(d_obj):
if d_obj is not None:
return str(d_obj)
Expand Down
3 changes: 2 additions & 1 deletion uw_hrp/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def person_search(**kwargs):
if "Persons" in data:
for person_record in data.get("Persons"):
persons.append(Person(data=person_record))
if "Next" in data and len(data["Next"].get("Href")) > 0:
if (data.get("Next") and data["Next"].get("Href") and
len(data["Next"]["Href"]) > 0):
url = data["Next"]["Href"]
else:
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"FutureWorker": null
},
"Next": {
"Href": "/hrp/v3/person.json?name=&page_start=2&page_size=1&worker_wid=&last_name=&first_name=&legal_last_name=&legal_first_name=&preferred_last_name=&preferred_first_name=&position=&retired=&terminated=&current_faculty=&active_appointment=&supervisory_organization=&cost_center=&custom_organization_type=&custom_organization=&location=&future_worker=",
"Href": null,
"ResourceName": null,
"PageStart": "2",
"PageSize": "1",
Expand Down
6 changes: 3 additions & 3 deletions uw_hrp/tests/test_person.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ def test_get_person_by_regid(self):
get_person_by_regid, "000")

def test_person_search(self):
pass
# persons = person_search(changed_since_date="2022-12-12")
# self.assertEqual(len(persons), 0)
persons = person_search(changed_since_date="2022-12-12")
self.assertEqual(len(persons), 1)
self.assertFalse(persons[0].is_active)

0 comments on commit 8d38da6

Please sign in to comment.