37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package sorare_utils
|
|
|
|
import (
|
|
"git.lehouerou.net/laurent/sorare/football"
|
|
|
|
"git.lehouerou.net/laurent/sorarebuddy/model"
|
|
)
|
|
|
|
func NewGameFromSorare(game football.Game) model.Game {
|
|
return model.Game{
|
|
Id: game.Id.Value,
|
|
Date: game.Date,
|
|
CoverageStatus: game.CoverageStatus,
|
|
LowCoverage: game.LowCoverage,
|
|
Minutes: int(game.Minute),
|
|
PeriodType: game.PeriodType,
|
|
Scored: game.Scored,
|
|
Status: game.Status,
|
|
CompetitionSlug: game.Competition.Slug,
|
|
FixtureSlug: game.So5Fixture.Slug,
|
|
AwayTeamSlug: game.AwayTeam.Team.Slug,
|
|
AwayGoals: int(game.AwayGoals),
|
|
AwayExtraTimeScore: int(game.ExtraTimeScoreAway),
|
|
AwayPenaltyScore: int(game.PenaltyScoreAway),
|
|
HomeTeamSlug: game.HomeTeam.Team.Slug,
|
|
HomeGoals: int(game.HomeGoals),
|
|
HomeExtraTimeScore: int(game.ExtraTimeScoreHome),
|
|
HomePenaltyScore: int(game.PenaltyScoreHome),
|
|
WinnerTeamSlug: func() *string {
|
|
if game.Winner.Team.Slug == "" {
|
|
return nil
|
|
}
|
|
return &game.Winner.Team.Slug
|
|
}(),
|
|
}
|
|
}
|