From 6e35f8eae9976ace0b6f44d1885b65084a0b6e5e Mon Sep 17 00:00:00 2001 From: silva guimaraes Date: Sat, 28 Jun 2025 19:00:18 -0300 Subject: [PATCH] deal with suspended matches --- lib/lib.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/lib.ml b/lib/lib.ml index b2b40e0..30a361d 100644 --- a/lib/lib.ml +++ b/lib/lib.ml @@ -70,6 +70,7 @@ type time = { start_timestamp : int; half : half } [@@deriving show] type status = | NotStarted of { start_timestamp : int } + | Suspended of { start_timestamp : int } | Postponed | Canceled | InProgress of time @@ -107,7 +108,7 @@ module Tournament = struct |> List.filter (fun x -> match x.status with | Postponed | Completed _ | Canceled -> false - | InProgress _ | NotStarted _ -> true) + | Suspended _ | InProgress _ | NotStarted _ -> true) |> List.filter (fun x -> if tournament.context.filter_foreigners then is_conmebol x.home_team || is_conmebol x.away_team @@ -116,6 +117,7 @@ module Tournament = struct let ts = match x.status with | Postponed | Canceled -> -1 + | Suspended t -> t.start_timestamp | NotStarted t -> t.start_timestamp | InProgress t -> t.start_timestamp | Completed t -> t.start_timestamp @@ -128,6 +130,7 @@ module Tournament = struct | Postponed | Completed _ | Canceled -> failwith "impossible: improper filter" | InProgress _ -> "NOW! " + | Suspended _ -> "SUS! " | NotStarted t -> ( let ts1 = t.start_timestamp |> float_of_int |> Unix.localtime @@ -203,10 +206,10 @@ let matches_of_api_events (e : api_events) = in let t = { start_timestamp = m.startTimestamp; half = h } in match typ with - | "notstarted" -> - NotStarted { start_timestamp = m.startTimestamp } + | "notstarted" -> NotStarted { start_timestamp = m.startTimestamp } | "postponed" -> Postponed | "canceled" -> Canceled + | "suspended" -> Suspended { start_timestamp = m.startTimestamp } | "inprogress" -> InProgress t | "finished" -> Completed t | _ -> failwith (sprintf "unrecognized match type: %s" typ));