deal with suspended matches
This commit is contained in:
parent
8af5cb0d33
commit
6e35f8eae9
1 changed files with 6 additions and 3 deletions
|
|
@ -70,6 +70,7 @@ type time = { start_timestamp : int; half : half } [@@deriving show]
|
||||||
|
|
||||||
type status =
|
type status =
|
||||||
| NotStarted of { start_timestamp : int }
|
| NotStarted of { start_timestamp : int }
|
||||||
|
| Suspended of { start_timestamp : int }
|
||||||
| Postponed
|
| Postponed
|
||||||
| Canceled
|
| Canceled
|
||||||
| InProgress of time
|
| InProgress of time
|
||||||
|
|
@ -107,7 +108,7 @@ module Tournament = struct
|
||||||
|> List.filter (fun x ->
|
|> List.filter (fun x ->
|
||||||
match x.status with
|
match x.status with
|
||||||
| Postponed | Completed _ | Canceled -> false
|
| Postponed | Completed _ | Canceled -> false
|
||||||
| InProgress _ | NotStarted _ -> true)
|
| Suspended _ | InProgress _ | NotStarted _ -> true)
|
||||||
|> List.filter (fun x ->
|
|> List.filter (fun x ->
|
||||||
if tournament.context.filter_foreigners then
|
if tournament.context.filter_foreigners then
|
||||||
is_conmebol x.home_team || is_conmebol x.away_team
|
is_conmebol x.home_team || is_conmebol x.away_team
|
||||||
|
|
@ -116,6 +117,7 @@ module Tournament = struct
|
||||||
let ts =
|
let ts =
|
||||||
match x.status with
|
match x.status with
|
||||||
| Postponed | Canceled -> -1
|
| Postponed | Canceled -> -1
|
||||||
|
| Suspended t -> t.start_timestamp
|
||||||
| NotStarted t -> t.start_timestamp
|
| NotStarted t -> t.start_timestamp
|
||||||
| InProgress t -> t.start_timestamp
|
| InProgress t -> t.start_timestamp
|
||||||
| Completed t -> t.start_timestamp
|
| Completed t -> t.start_timestamp
|
||||||
|
|
@ -128,6 +130,7 @@ module Tournament = struct
|
||||||
| Postponed | Completed _ | Canceled ->
|
| Postponed | Completed _ | Canceled ->
|
||||||
failwith "impossible: improper filter"
|
failwith "impossible: improper filter"
|
||||||
| InProgress _ -> "NOW! "
|
| InProgress _ -> "NOW! "
|
||||||
|
| Suspended _ -> "SUS! "
|
||||||
| NotStarted t -> (
|
| NotStarted t -> (
|
||||||
let ts1 =
|
let ts1 =
|
||||||
t.start_timestamp |> float_of_int |> Unix.localtime
|
t.start_timestamp |> float_of_int |> Unix.localtime
|
||||||
|
|
@ -203,10 +206,10 @@ let matches_of_api_events (e : api_events) =
|
||||||
in
|
in
|
||||||
let t = { start_timestamp = m.startTimestamp; half = h } in
|
let t = { start_timestamp = m.startTimestamp; half = h } in
|
||||||
match typ with
|
match typ with
|
||||||
| "notstarted" ->
|
| "notstarted" -> NotStarted { start_timestamp = m.startTimestamp }
|
||||||
NotStarted { start_timestamp = m.startTimestamp }
|
|
||||||
| "postponed" -> Postponed
|
| "postponed" -> Postponed
|
||||||
| "canceled" -> Canceled
|
| "canceled" -> Canceled
|
||||||
|
| "suspended" -> Suspended { start_timestamp = m.startTimestamp }
|
||||||
| "inprogress" -> InProgress t
|
| "inprogress" -> InProgress t
|
||||||
| "finished" -> Completed t
|
| "finished" -> Completed t
|
||||||
| _ -> failwith (sprintf "unrecognized match type: %s" typ));
|
| _ -> failwith (sprintf "unrecognized match type: %s" typ));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue