diff --git a/api/barriers/serializers/data_workspace.py b/api/barriers/serializers/data_workspace.py index 9667a357..e51dc396 100644 --- a/api/barriers/serializers/data_workspace.py +++ b/api/barriers/serializers/data_workspace.py @@ -471,12 +471,12 @@ def get_date_estimated_resolution_date_first_added(self, instance): estimated_resolution_date__isnull=False ).order_by("history_date") - first = history.values("estimated_resolution_date").first() + first = history.values("history_date").first() if not first: return - return first["estimated_resolution_date"].strftime("%Y-%m-%d") + return first["history_date"].strftime("%Y-%m-%d") def get_overseas_region(self, instance) -> typing.List[str]: if instance.country: diff --git a/tests/barriers/test_datawarehouse.py b/tests/barriers/test_datawarehouse.py index fed01844..3a5fb862 100644 --- a/tests/barriers/test_datawarehouse.py +++ b/tests/barriers/test_datawarehouse.py @@ -568,8 +568,9 @@ def test_estimated_resolution_date_first_added(self): estimated_resolution_date=None, ) ts1 = date.today() + ts2 = datetime.timedelta(days=10) + ts1 with freezegun.freeze_time(ts1): - barrier.estimated_resolution_date = ts1 + barrier.estimated_resolution_date = ts2 barrier.save() data = DataWorkspaceSerializer(barrier).data @@ -577,9 +578,9 @@ def test_estimated_resolution_date_first_added(self): "%Y-%m-%d" ) - ts2 = ts1 + datetime.timedelta(days=1) + ts3 = ts2 + datetime.timedelta(days=12) with freezegun.freeze_time(ts2): - barrier.estimated_resolution_date = ts2 + barrier.estimated_resolution_date = ts3 barrier.save() data = DataWorkspaceSerializer(barrier).data