Skip to content

Commit

Permalink
Minor improvements to PhD Hiring Export (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisJordan authored Aug 12, 2024
1 parent e11ec93 commit 50d1b6a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions backend/api/academics/hiring.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def get_hiring_summary_csv(
"id",
"last_name",
"first_name",
"pid",
"onyen",
"email",
"program_pursued",
Expand All @@ -258,6 +259,7 @@ def get_hiring_summary_csv(
"id": d.id,
"last_name": d.applicant.last_name,
"first_name": d.applicant.first_name,
"pid": d.applicant.pid,
"onyen": d.applicant.onyen,
"email": d.applicant.email,
"program_pursued": d.program_pursued,
Expand Down
4 changes: 2 additions & 2 deletions backend/models/academics/hiring/phd_application.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from pydantic import BaseModel
from ...public_user import PublicUser
from ...user import User
from ..section import CatalogSectionIdentity


class PhDApplicationReview(BaseModel):
id: int
applicant: PublicUser
applicant: User
applicant_name: str
advisor: str | None
program_pursued: str
Expand Down
14 changes: 8 additions & 6 deletions backend/services/academics/hiring.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def get_phd_applicants(
for application in all:
phd_application = PhDApplicationReview(
id=application.id,
applicant=application.user.to_public_model(),
applicant=application.user.to_model(),
applicant_name=application.user.full_name(),
advisor=application.advisor,
program_pursued=application.program_pursued,
Expand All @@ -226,10 +226,12 @@ def get_phd_applicants(
.where(section_application_table.c.application_id.in_(application_ids))
.order_by(section_application_table.c.preference)
)
for section_application in self._session.execute(section_application_query):
preference, section_id, application_id = section_application
for idx, section_application in enumerate(
self._session.execute(section_application_query)
):
_, section_id, application_id = section_application
phd_applications[application_id].student_preferences.append(
f"{preference}. {sections[section_id].course_id}.{sections[section_id].number}"
f"{idx}. {sections[section_id].course_id}.{sections[section_id].number}"
)

# Grab instructor preferences of applications
Expand All @@ -244,9 +246,9 @@ def get_phd_applicants(
)
)
instructor_preferences = self._session.scalars(instructor_review_query).all()
for review in instructor_preferences:
for idx, review in enumerate(instructor_preferences):
phd_applications[review.application_id].instructor_preferences.append(
f"{review.preference}. {review.course_site.sections[0].course_id}.{review.course_site.sections[0].number}"
f"{idx}. {review.course_site.sections[0].course_id}.{review.course_site.sections[0].number}"
)

return list(phd_applications.values())
Expand Down

0 comments on commit 50d1b6a

Please sign in to comment.