Change performer height to be numeric (#3060)

* Make height an int. Add height_cm field
* Change UI to use height_cm
* Use number fields for height/weight
* Add migration note
This commit is contained in:
WithoutPants
2022-11-08 14:09:03 +11:00
committed by GitHub
parent b9e07ade92
commit d2743cf5fb
35 changed files with 432 additions and 99 deletions

View File

@@ -3,9 +3,11 @@ package performer
import (
"context"
"fmt"
"strconv"
"strings"
"github.com/stashapp/stash/pkg/hash/md5"
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/models/jsonschema"
"github.com/stashapp/stash/pkg/sliceutil/stringslice"
@@ -194,7 +196,6 @@ func performerJSONToPerformer(performerJSON jsonschema.Performer) models.Perform
Ethnicity: performerJSON.Ethnicity,
Country: performerJSON.Country,
EyeColor: performerJSON.EyeColor,
Height: performerJSON.Height,
Measurements: performerJSON.Measurements,
FakeTits: performerJSON.FakeTits,
CareerLength: performerJSON.CareerLength,
@@ -235,5 +236,14 @@ func performerJSONToPerformer(performerJSON jsonschema.Performer) models.Perform
newPerformer.Weight = &performerJSON.Weight
}
if performerJSON.Height != "" {
h, err := strconv.Atoi(performerJSON.Height)
if err == nil {
newPerformer.Height = &h
} else {
logger.Warnf("error parsing height %q: %v", performerJSON.Height, err)
}
}
return newPerformer
}