-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IAMTEAM-111] Fix users' display name casing being mangled during lex…
…ical analysis (#127) * [IAMTEAM-111] Fix users' display name casing being mangled during lexical analysis * [Bot] Update version to 2.1.5 Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5326bb0
commit 5b4b102
Showing
9 changed files
with
259 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from typing import List, NoReturn | ||
|
||
from husky_directory.models.base import DirectoryBaseModel | ||
from husky_directory.models.pws import PersonOutput | ||
from husky_directory.services.name_analyzer import NameAnalyzer | ||
|
||
|
||
class ResultBucket(DirectoryBaseModel): | ||
description: str | ||
students: List[PersonOutput] = [] | ||
employees: List[PersonOutput] = [] | ||
|
||
# The relevance is an index value to help sort the | ||
# buckets themselves. The lower the value, the closer | ||
# to the beginning of a list of buckets this bucket will be. | ||
relevance: int = 0 | ||
|
||
def add_person(self, pws_person: PersonOutput) -> NoReturn: | ||
if pws_person.affiliations.employee: | ||
self.employees.append(pws_person) | ||
if pws_person.affiliations.student: | ||
self.students.append(pws_person) | ||
|
||
@property | ||
def sorted_students(self) -> List[PersonOutput]: | ||
return sorted(self.students, key=lambda p: NameAnalyzer(p).sort_key) | ||
|
||
@property | ||
def sorted_employees(self) -> List[PersonOutput]: | ||
return sorted(self.employees, key=lambda p: NameAnalyzer(p).sort_key) |
Oops, something went wrong.