diff --git a/compass/clients/person_client.py b/compass/clients/person_client.py index f29350a2..a0e5cd91 100644 --- a/compass/clients/person_client.py +++ b/compass/clients/person_client.py @@ -57,7 +57,8 @@ def get_adviser_caseload(self, uwnetid): self.DB.Student.enroll_status_desc, self.DB.Student.id, self.DB.Transcript.scholarship_type, - self.DB.Transcript.scholarship_desc)\ + self.DB.Transcript.scholarship_desc, + self.DB.Person.surname)\ .join(self.DB.Person)\ .join(self.DB.StudentToAdviser)\ .join(self.DB.Adviser)\ @@ -94,6 +95,7 @@ def get_adviser_caseload(self, uwnetid): latest_transcript = Transcript() latest_transcript.scholarship_type = item[17] latest_transcript.scholarship_desc = item[18] + person.surname = item[19] student.transcripts = [latest_transcript] student.degrees = [] person.student = student @@ -102,8 +104,8 @@ def get_adviser_caseload(self, uwnetid): for degree in self.get_degrees(persons.keys()): persons[degree.student_id].student.degrees.append(degree) - # sorting by display name, can't get it to work in SQL-Alchemy - return sorted(persons.values(), key=lambda p: p.display_name) + # sorting by surname, can't get it to work in SQL-Alchemy + return sorted(persons.values(), key=lambda p: p.surname) def get_appuser_by_uwnetid(self, uwnetid): cache_key = f'appuser_{uwnetid}' diff --git a/compass/models.py b/compass/models.py index 26836623..7fc08d0d 100644 --- a/compass/models.py +++ b/compass/models.py @@ -7,7 +7,7 @@ from django.utils.text import slugify from django.utils.timezone import utc from simple_history.models import HistoricalRecords -from compass.clients import CompassPersonClient +from compass.clients import CompassPersonClient, PersonNotFoundException from compass.dao.group import is_group_member from compass.dao import current_datetime from datetime import datetime, timedelta @@ -80,8 +80,12 @@ def __str__(self): @property def display_name(self): if self.uwnetid: - person = CompassPersonClient().get_appuser_by_uwnetid(self.uwnetid) - return person.display_name + try: + person = CompassPersonClient().get_appuser_by_uwnetid( + self.uwnetid) + return person.display_name + except PersonNotFoundException: + return self.uwnetid class Student(models.Model): diff --git a/compass_vue/components/student/contact.vue b/compass_vue/components/student/contact.vue index da6ca696..337c7e5f 100644 --- a/compass_vue/components/student/contact.vue +++ b/compass_vue/components/student/contact.vue @@ -18,26 +18,26 @@ - - + - -
DateDetailsDetails  
-
- {{ contactDate(contact.checkin_date) }} -
-
- {{ contact.app_user.uwnetid }} -- - {{ contact.source }} - -- - {{ contact.trans_id }} +
+
+
+ {{ contact.app_user.display_name }} + ({{ contact.app_user.uwnetid }}) +
+
+ + {{ getTimeFromNow(contact.checkin_date) }} +
-
+