This is a little confusing to describe, but our logic to get the most recent salary assumes it will always be associated with the most recent job. This is not the case because our jobs are associated with the first vintage we saw them in, so if a person had a job in 2017, then a different job in 2018, then returned to the original job in 2019 (likely just messy data entry), our logic looks for the salary with the more "recent" job, 2018, doesn't find it, and breaks.
Salary.DoesNotExist: Salary matching query does not exist.
(12 additional frame(s) were not displayed)
...
File "rest_framework/fields.py", line 1905, in to_representation
return method(value)
File "payroll/serializers.py", line 635, in get_current_salary
return self.person_current_salary.total_pay
File "payroll/serializers.py", line 591, in person_current_salary
vintage__standardized_file__reporting_year=self.context['data_year']
File "django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "django/db/models/query.py", line 408, in get
self.model._meta.object_name
This is a little confusing to describe, but our logic to get the most recent salary assumes it will always be associated with the most recent job. This is not the case because our jobs are associated with the first vintage we saw them in, so if a person had a job in 2017, then a different job in 2018, then returned to the original job in 2019 (likely just messy data entry), our logic looks for the salary with the more "recent" job, 2018, doesn't find it, and breaks.
E.g., https://bga-payroll.datamade.us/person/leonard-m-shoshi-20e87a51/ (or many other Chicago Police Department employees)
Sentry Issue: BGA-PAYROLL-DATABASE-E6