Event Timeline
Comment Actions
Take 2 which sounds simpler:
def origin_visit_find_latest_status( origin_url: str, ) -> Optional[OriginVisitInfo]: """Retrieve origin visit status whose date is most recent than the provided visit_date. Args: origin_url: origin concerned by the visit visit_date: provided visit date Returns: The dict origin_visit_status matching the criteria if any. """ visit_page = storage.origin_visit_get( origin_url, limit=1, order=ListOrder.DESC ) if not visit_page.results: return None visit = visit_page.results[0] visit_status = storage.origin_visit_status_get_latest(origin_url, visit.visit) return converters.from_origin_visit({**visit_status.to_dict(), "type": visit.type})