mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Fix scraping stash-box performers with null birthdates (#5428)
This commit is contained in:
@@ -648,9 +648,8 @@ func performerFragmentToScrapedPerformer(p graphql.PerformerFragment) *models.Sc
|
||||
sp.Height = &hs
|
||||
}
|
||||
|
||||
if p.Birthdate != nil {
|
||||
b := p.Birthdate.Date
|
||||
sp.Birthdate = &b
|
||||
if p.BirthDate != nil {
|
||||
sp.Birthdate = padFuzzyDate(p.BirthDate)
|
||||
}
|
||||
|
||||
if p.Gender != nil {
|
||||
@@ -1356,3 +1355,20 @@ func (c *Client) submitDraft(ctx context.Context, query string, input interface{
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func padFuzzyDate(date *string) *string {
|
||||
if date == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var paddedDate string
|
||||
switch len(*date) {
|
||||
case 10:
|
||||
paddedDate = *date
|
||||
case 7:
|
||||
paddedDate = fmt.Sprintf("%s-01", *date)
|
||||
case 4:
|
||||
paddedDate = fmt.Sprintf("%s-01-01", *date)
|
||||
}
|
||||
return &paddedDate
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user