diff --git a/internal/api/changeset_translator.go b/internal/api/changeset_translator.go index 412f12db99e..d148d47dacc 100644 --- a/internal/api/changeset_translator.go +++ b/internal/api/changeset_translator.go @@ -153,40 +153,6 @@ func (t changesetTranslator) intPtrFromString(value *string) (*int, error) { return &vv, nil } -func (t changesetTranslator) ratingConversion(legacyValue *int, rating100Value *int) *int { - const ( - legacyField = "rating" - rating100Field = "rating100" - ) - - legacyRating := t.optionalInt(legacyValue, legacyField) - if legacyRating.Set && !legacyRating.Null { - ret := models.Rating5To100(legacyRating.Value) - return &ret - } - - o := t.optionalInt(rating100Value, rating100Field) - if o.Set && !o.Null { - return &o.Value - } - - return nil -} - -func (t changesetTranslator) optionalRatingConversion(legacyValue *int, rating100Value *int) models.OptionalInt { - const ( - legacyField = "rating" - rating100Field = "rating100" - ) - - legacyRating := t.optionalInt(legacyValue, legacyField) - if legacyRating.Set && !legacyRating.Null { - legacyRating.Value = models.Rating5To100(legacyRating.Value) - return legacyRating - } - return t.optionalInt(rating100Value, rating100Field) -} - func (t changesetTranslator) optionalInt(value *int, field string) models.OptionalInt { if !t.hasField(field) { return models.OptionalInt{} diff --git a/internal/api/resolver_model_image.go b/internal/api/resolver_model_image.go index dcb7e6ce1af..bc9d991a7e2 100644 --- a/internal/api/resolver_model_image.go +++ b/internal/api/resolver_model_image.go @@ -17,19 +17,6 @@ func convertVisualFile(f models.File) (models.VisualFile, error) { return vf, nil } -func (r *imageResolver) getPrimaryFile(ctx context.Context, obj *models.Image) (models.VisualFile, error) { - if obj.PrimaryFileID != nil { - f, err := loaders.From(ctx).FileByID.Load(*obj.PrimaryFileID) - if err != nil { - return nil, err - } - - return convertVisualFile(f) - } - - return nil, nil -} - func (r *imageResolver) getFiles(ctx context.Context, obj *models.Image) ([]models.File, error) { fileIDs, err := loaders.From(ctx).ImageFiles.Load(obj.ID) if err != nil { diff --git a/internal/api/types.go b/internal/api/types.go index 372c094b8b4..d08f82a28de 100644 --- a/internal/api/types.go +++ b/internal/api/types.go @@ -1,21 +1,9 @@ package api import ( - "math" - "github.com/stashapp/stash/pkg/models" ) -// #1572 - Inf and NaN values cause the JSON marshaller to fail -// Return nil for these values -func handleFloat64(v float64) *float64 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil - } - - return &v -} - func stashIDsSliceToPtrSlice(v []models.StashID) []*models.StashID { ret := make([]*models.StashID, len(v)) for i, vv := range v { diff --git a/pkg/models/model_scene_test.go b/pkg/models/model_scene_test.go index d47e86c7fe1..4eb5c1833d2 100644 --- a/pkg/models/model_scene_test.go +++ b/pkg/models/model_scene_test.go @@ -12,17 +12,16 @@ func TestScenePartial_UpdateInput(t *testing.T) { ) var ( - title = "title" - code = "1337" - details = "details" - director = "director" - url = "url" - date = "2001-02-03" - ratingLegacy = 4 - rating100 = 80 - organized = true - studioID = 2 - studioIDStr = "2" + title = "title" + code = "1337" + details = "details" + director = "director" + url = "url" + date = "2001-02-03" + rating100 = 80 + organized = true + studioID = 2 + studioIDStr = "2" ) dateObj, _ := ParseDate(date) @@ -58,7 +57,6 @@ func TestScenePartial_UpdateInput(t *testing.T) { Director: &director, Urls: []string{url}, Date: &date, - Rating: &ratingLegacy, Rating100: &rating100, Organized: &organized, StudioID: &studioIDStr,