diff --git a/process_report/processors/validate_billable_pi_processor.py b/process_report/processors/validate_billable_pi_processor.py index 9a0fb70..88c62ba 100644 --- a/process_report/processors/validate_billable_pi_processor.py +++ b/process_report/processors/validate_billable_pi_processor.py @@ -31,9 +31,15 @@ def _get_billables( nonbillable_pis: list[str], nonbillable_projects: list[str], ): + def _str_to_lowercase(data): + return data.lower() + + nonbillable_projects_lowercase = [ + project.lower() for project in nonbillable_projects + ] return ~data[invoice.PI_FIELD].isin(nonbillable_pis) & ~data[ invoice.PROJECT_FIELD - ].isin(nonbillable_projects) + ].apply(_str_to_lowercase).isin(nonbillable_projects_lowercase) def _process(self): self.data[invoice.IS_BILLABLE_FIELD] = self._get_billables( diff --git a/process_report/tests/unit/processors/test_validate_billable_pi_processor.py b/process_report/tests/unit/processors/test_validate_billable_pi_processor.py index 1d68167..ca99238 100644 --- a/process_report/tests/unit/processors/test_validate_billable_pi_processor.py +++ b/process_report/tests/unit/processors/test_validate_billable_pi_processor.py @@ -11,7 +11,9 @@ def test_remove_nonbillables(self): pis = [uuid.uuid4().hex for x in range(10)] projects = [uuid.uuid4().hex for x in range(10)] nonbillable_pis = pis[:3] - nonbillable_projects = projects[7:] + nonbillable_projects = [ + project.upper() for project in projects[7:] + ] # Test for case-insentivity billable_pis = pis[3:7] data = pandas.DataFrame({"Manager (PI)": pis, "Project - Allocation": projects})