From 5de06d4b6253c665112db7e9377df139480b63e1 Mon Sep 17 00:00:00 2001 From: kermieisinthehouse Date: Tue, 26 Oct 2021 17:55:11 -0700 Subject: [PATCH] Convert filesize to float64 for arm32 (#1895) * Convert filesize to float64 for arm32 --- graphql/schema/types/image.graphql | 2 +- graphql/schema/types/scene.graphql | 2 +- pkg/api/resolver_query_find_scene.go | 2 +- pkg/models/image.go | 2 +- pkg/models/scene.go | 2 +- pkg/sqlite/image.go | 2 +- pkg/sqlite/scene.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/graphql/schema/types/image.graphql b/graphql/schema/types/image.graphql index 1d184cd53..da3b56ee6 100644 --- a/graphql/schema/types/image.graphql +++ b/graphql/schema/types/image.graphql @@ -73,6 +73,6 @@ type FindImagesResultType { """Total megapixels of the images""" megapixels: Float! """Total file size in bytes""" - filesize: Int! + filesize: Float! images: [Image!]! } \ No newline at end of file diff --git a/graphql/schema/types/scene.graphql b/graphql/schema/types/scene.graphql index 051ed5222..208a43929 100644 --- a/graphql/schema/types/scene.graphql +++ b/graphql/schema/types/scene.graphql @@ -123,7 +123,7 @@ type FindScenesResultType { """Total duration in seconds""" duration: Float! """Total file size in bytes""" - filesize: Int! + filesize: Float! scenes: [Scene!]! } diff --git a/pkg/api/resolver_query_find_scene.go b/pkg/api/resolver_query_find_scene.go index 6aa041545..3b789ea32 100644 --- a/pkg/api/resolver_query_find_scene.go +++ b/pkg/api/resolver_query_find_scene.go @@ -78,7 +78,7 @@ func (r *queryResolver) FindScenes(ctx context.Context, sceneFilter *models.Scen result.Count = len(scenes) for _, s := range scenes { result.TotalDuration += s.Duration.Float64 - size, _ := strconv.Atoi(s.Size.String) + size, _ := strconv.ParseFloat(s.Size.String, 64) result.TotalSize += size } } diff --git a/pkg/models/image.go b/pkg/models/image.go index 24267d258..bae3c043f 100644 --- a/pkg/models/image.go +++ b/pkg/models/image.go @@ -11,7 +11,7 @@ type ImageQueryOptions struct { type ImageQueryResult struct { QueryResult Megapixels float64 - TotalSize int + TotalSize float64 finder ImageFinder images []*Image diff --git a/pkg/models/scene.go b/pkg/models/scene.go index 8f499f1e0..a86f75ff0 100644 --- a/pkg/models/scene.go +++ b/pkg/models/scene.go @@ -11,7 +11,7 @@ type SceneQueryOptions struct { type SceneQueryResult struct { QueryResult TotalDuration float64 - TotalSize int + TotalSize float64 finder SceneFinder scenes []*Scene diff --git a/pkg/sqlite/image.go b/pkg/sqlite/image.go index d437be2a2..f82c9e2ba 100644 --- a/pkg/sqlite/image.go +++ b/pkg/sqlite/image.go @@ -330,7 +330,7 @@ func (qb *imageQueryBuilder) queryGroupedFields(options models.ImageQueryOptions out := struct { Total int Megapixels float64 - Size int + Size float64 }{} if err := qb.repository.queryStruct(aggregateQuery.toSQL(includeSortPagination), query.args, &out); err != nil { return nil, err diff --git a/pkg/sqlite/scene.go b/pkg/sqlite/scene.go index 9156cf742..97d0b6899 100644 --- a/pkg/sqlite/scene.go +++ b/pkg/sqlite/scene.go @@ -469,7 +469,7 @@ func (qb *sceneQueryBuilder) queryGroupedFields(options models.SceneQueryOptions out := struct { Total int Duration float64 - Size int + Size float64 }{} if err := qb.repository.queryStruct(aggregateQuery.toSQL(includeSortPagination), query.args, &out); err != nil { return nil, err