bugfix
This commit is contained in:
parent
116ed0068b
commit
f613203cbe
1 changed files with 43 additions and 9 deletions
52
lib/lib.ml
52
lib/lib.ml
|
|
@ -309,6 +309,21 @@ let tables_of_api_standings_total (s : api_standings_total) : table list =
|
|||
let matches_of_api_events (e : api_events) =
|
||||
e.events
|
||||
|> List.map (fun (m : api_match) ->
|
||||
let period_start_timestamp =
|
||||
match m.time with
|
||||
| {
|
||||
currentPeriodStartTimestamp = Some x;
|
||||
injuryTime1 = _;
|
||||
injuryTime2 = _;
|
||||
} ->
|
||||
x
|
||||
| {
|
||||
currentPeriodStartTimestamp = None;
|
||||
injuryTime1 = _;
|
||||
injuryTime2 = _;
|
||||
} ->
|
||||
m.startTimestamp
|
||||
in
|
||||
{
|
||||
home_team = m.homeTeam;
|
||||
away_team = m.awayTeam;
|
||||
|
|
@ -336,14 +351,13 @@ let matches_of_api_events (e : api_events) =
|
|||
{
|
||||
injuryTime1 = x;
|
||||
injuryTime2 = None;
|
||||
currentPeriodStartTimestamp = Some z;
|
||||
currentPeriodStartTimestamp = _;
|
||||
} ) ->
|
||||
InProgress
|
||||
{
|
||||
start_timestamp = m.startTimestamp;
|
||||
half =
|
||||
First_Half
|
||||
{ injury_time1 = x; period_start_timestamp = z };
|
||||
First_Half { injury_time1 = x; period_start_timestamp };
|
||||
score =
|
||||
{
|
||||
home_score = m.homeScore.current;
|
||||
|
|
@ -355,7 +369,7 @@ let matches_of_api_events (e : api_events) =
|
|||
{
|
||||
injuryTime1 = x;
|
||||
injuryTime2 = y;
|
||||
currentPeriodStartTimestamp = Some z;
|
||||
currentPeriodStartTimestamp = _;
|
||||
} ) ->
|
||||
InProgress
|
||||
{
|
||||
|
|
@ -365,7 +379,7 @@ let matches_of_api_events (e : api_events) =
|
|||
{
|
||||
injury_time1 = x;
|
||||
injury_time2 = y;
|
||||
period_start_timestamp = z;
|
||||
period_start_timestamp;
|
||||
};
|
||||
score =
|
||||
{
|
||||
|
|
@ -378,7 +392,7 @@ let matches_of_api_events (e : api_events) =
|
|||
{
|
||||
injuryTime1 = x;
|
||||
injuryTime2 = y;
|
||||
currentPeriodStartTimestamp = Some z;
|
||||
currentPeriodStartTimestamp = _;
|
||||
} ) ->
|
||||
InProgress
|
||||
{
|
||||
|
|
@ -388,7 +402,7 @@ let matches_of_api_events (e : api_events) =
|
|||
{
|
||||
injury_time1 = x;
|
||||
injury_time2 = y;
|
||||
period_start_timestamp = z;
|
||||
period_start_timestamp;
|
||||
};
|
||||
score =
|
||||
{
|
||||
|
|
@ -420,7 +434,7 @@ let matches_of_api_events (e : api_events) =
|
|||
{
|
||||
injuryTime1 = x;
|
||||
injuryTime2 = y;
|
||||
currentPeriodStartTimestamp = Some z;
|
||||
currentPeriodStartTimestamp = _;
|
||||
} ) ->
|
||||
InProgress
|
||||
{
|
||||
|
|
@ -430,7 +444,7 @@ let matches_of_api_events (e : api_events) =
|
|||
{
|
||||
injury_time1 = x;
|
||||
injury_time2 = y;
|
||||
period_start_timestamp = z;
|
||||
period_start_timestamp;
|
||||
};
|
||||
score =
|
||||
{
|
||||
|
|
@ -438,6 +452,23 @@ let matches_of_api_events (e : api_events) =
|
|||
away_score = m.awayScore.current;
|
||||
};
|
||||
}
|
||||
| ( "Awaiting penalties",
|
||||
"inprogress",
|
||||
{
|
||||
injuryTime1 = _;
|
||||
injuryTime2 = _;
|
||||
currentPeriodStartTimestamp = _;
|
||||
} ) ->
|
||||
InProgress
|
||||
{
|
||||
start_timestamp = m.startTimestamp;
|
||||
half = Penalties;
|
||||
score =
|
||||
{
|
||||
home_score = m.homeScore.current;
|
||||
away_score = m.awayScore.current;
|
||||
};
|
||||
}
|
||||
| ( "Penalties",
|
||||
"inprogress",
|
||||
{
|
||||
|
|
@ -496,6 +527,9 @@ let matches_of_api_events (e : api_events) =
|
|||
(show_api_time m.time));
|
||||
})
|
||||
|
||||
(* https://www.sofascore.com/api/v1/unique-tournament/480/season/70070/rounds *)
|
||||
(* https://www.sofascore.com/api/v1/unique-tournament/480/season/70070/events/round/636/slug/playoff-round *)
|
||||
|
||||
let fetch ctx order (* "last" for previous matches "next" for future matches *)
|
||||
=
|
||||
try%lwt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue