Compare commits

...

2 Commits

Author SHA1 Message Date
5624a07607 add stats to memberships 2024-04-18 14:48:16 +04:00
c693dd2017 remove debug logs 2024-04-16 15:46:39 +04:00
2 changed files with 15 additions and 3 deletions

View File

@ -40,6 +40,20 @@ type CardSupply struct {
Unique int `graphql:"unique"`
}
type MembershipStats struct {
Season struct {
StartYear int `graphql:"startYear"`
} `graphql:"season"`
Appearances int `graphql:"appearances"`
Goals int `graphql:"goals"`
Assists int `graphql:"assists"`
YellowCards int `graphql:"yellowCards"`
RedCards int `graphql:"redCards"`
MinutesPlayed int `graphql:"minutesPlayed"`
SubstituteIn int `graphql:"substituteIn"`
SubstituteOut int `graphql:"substituteOut"`
}
type Membership struct {
Id graphql.Id `graphql:"id"`
StartDate time.Time `graphql:"startDate"`
@ -53,6 +67,7 @@ type Membership struct {
Slug string `graphql:"slug"`
} `graphql:"... on NationalTeam"`
} `graphql:"membershipTeam"`
Stats []MembershipStats `graphql:"stats"`
}
type Player struct {

View File

@ -3,8 +3,6 @@ package graphql
import (
"context"
"reflect"
"github.com/rs/zerolog/log"
)
type PaginatedQuery[ResultType any, Params any] struct {
@ -71,7 +69,6 @@ func (pq *PaginatedQuery[ResultType, Params]) Get(
after := ""
var noop ResultType
pageSize := (pq.c.MaxComplexity() - 9) / (GetComplexity(reflect.TypeOf(noop)) + 1)
log.Debug().Msgf("using page size %d", pageSize)
for {
page, pi, err := pq.getPage(ctx, params, after, pageSize)
if err != nil {