Closed heming-langrenn closed 2 years ago
Fjerne denne: f"{RACE_SERVICE_URL}/races/{race_id}/race-results
Har oppdaget at denne returnerer feil i noen tilfeller, men å hente results gjennom "get_race_by_id" fungerer bra. Foreslår derfor å fjerne get race-results.
Koden jeg bruker: race_details = await RaceplansAdapter().get_race_by_id( user["token"], race["id"] ) finish_results = get_finish_rank(race_details)
def get_finish_rank(race: dict) -> list: """Extract timing events from finish.""" finish_rank = [] results = race["results"] if len(results) > 0: logging.debug(f"Resultst: {results}") if "Finish" in results.keys(): finish_results = results["Finish"] if len(finish_results) > 0: logging.debug(finish_results.keys()) if "ranking_sequence" in finish_results.keys(): finish_ranks = finish_results["ranking_sequence"] race["finish_results"] = [] for rank_event in finish_ranks: if rank_event["status"] == "OK": finish_rank.append(rank_event) return finish_rank
Setter denne til invalid da race-results vil bli brukt i forbindelse med publisering av resultater.
Fjerne denne: f"{RACE_SERVICE_URL}/races/{race_id}/race-results
Har oppdaget at denne returnerer feil i noen tilfeller, men å hente results gjennom "get_race_by_id" fungerer bra. Foreslår derfor å fjerne get race-results.
Koden jeg bruker: race_details = await RaceplansAdapter().get_race_by_id( user["token"], race["id"] ) finish_results = get_finish_rank(race_details)
def get_finish_rank(race: dict) -> list: """Extract timing events from finish.""" finish_rank = [] results = race["results"] if len(results) > 0: logging.debug(f"Resultst: {results}") if "Finish" in results.keys(): finish_results = results["Finish"] if len(finish_results) > 0: logging.debug(finish_results.keys()) if "ranking_sequence" in finish_results.keys(): finish_ranks = finish_results["ranking_sequence"] race["finish_results"] = [] for rank_event in finish_ranks: if rank_event["status"] == "OK": finish_rank.append(rank_event) return finish_rank