diff --git a/swh/web/common/archive.py b/swh/web/common/archive.py --- a/swh/web/common/archive.py +++ b/swh/web/common/archive.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2020 The Software Heritage developers +# Copyright (C) 2015-2021 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -977,7 +977,7 @@ """ - visit_and_status = origin_get_latest_visit_status( + visit_status = origin_get_latest_visit_status( storage, origin_url, type=type, @@ -985,11 +985,7 @@ require_snapshot=require_snapshot, ) return ( - converters.from_origin_visit( - {**visit_and_status[0].to_dict(), **visit_and_status[1].to_dict()} - ) - if visit_and_status - else None + converters.from_origin_visit(visit_status.to_dict()) if visit_status else None ) diff --git a/swh/web/tests/conftest.py b/swh/web/tests/conftest.py --- a/swh/web/tests/conftest.py +++ b/swh/web/tests/conftest.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2020 The Software Heritage developers +# Copyright (C) 2018-2021 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -269,7 +269,7 @@ allowed_statuses: Optional[List[str]] = None, require_snapshot: bool = False, ): - visit_and_status = origin_get_latest_visit_status( + visit_status = origin_get_latest_visit_status( self.storage, origin_url, type=type, @@ -277,10 +277,8 @@ require_snapshot=require_snapshot, ) return ( - converters.from_origin_visit( - {**visit_and_status[0].to_dict(), **visit_and_status[1].to_dict()} - ) - if visit_and_status + converters.from_origin_visit(visit_status.to_dict()) + if visit_status else None ) diff --git a/swh/web/tests/data.py b/swh/web/tests/data.py --- a/swh/web/tests/data.py +++ b/swh/web/tests/data.py @@ -223,6 +223,7 @@ origin=url, visit=visit.visit, date=date + timedelta(minutes=1), + type=visit.type, status="full", snapshot=hash_to_bytes("1a8893e6a86f444e8be8e7bda6cb34fb1735a00e"), )