From c8bcaaf27d915dd8eb43533d184f800384eaed1a Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Thu, 24 Dec 2020 09:03:23 +1100 Subject: [PATCH] Fix scene file name parser update (#998) * Fix conversion of input maps * Only set changed scene values in parser update --- pkg/api/changeset_translator.go | 9 ++++++++- .../SceneFilenameParser/SceneParserRow.tsx | 19 ++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg/api/changeset_translator.go b/pkg/api/changeset_translator.go index e71912645..99c469ee0 100644 --- a/pkg/api/changeset_translator.go +++ b/pkg/api/changeset_translator.go @@ -39,7 +39,14 @@ func getUpdateInputMaps(ctx context.Context) []map[string]interface{} { input, _ := args[updateInputField] var ret []map[string]interface{} if input != nil { - ret, _ = input.([]map[string]interface{}) + // convert []interface{} into []map[string]interface{} + iSlice, _ := input.([]interface{}) + for _, i := range iSlice { + m, _ := i.(map[string]interface{}) + if m != nil { + ret = append(ret, m) + } + } } return ret diff --git a/ui/v2.5/src/components/SceneFilenameParser/SceneParserRow.tsx b/ui/v2.5/src/components/SceneFilenameParser/SceneParserRow.tsx index c922f1e69..e3bffd9d3 100644 --- a/ui/v2.5/src/components/SceneFilenameParser/SceneParserRow.tsx +++ b/ui/v2.5/src/components/SceneFilenameParser/SceneParserRow.tsx @@ -81,19 +81,12 @@ export class SceneParserResult { public toSceneUpdateInput() { return { id: this.id, - details: this.scene.details, - url: this.scene.url, - rating: this.rating.isSet ? this.rating.value : this.scene.rating, - gallery_id: this.scene.gallery?.id, - title: this.title.isSet ? this.title.value : this.scene.title, - date: this.date.isSet ? this.date.value : this.scene.date, - studio_id: this.studio.isSet ? this.studio.value : this.scene.studio?.id, - performer_ids: this.performers.isSet - ? this.performers.value - : this.scene.performers.map((performer) => performer.id), - tag_ids: this.tags.isSet - ? this.tags.value - : this.scene.tags.map((tag) => tag.id), + rating: this.rating.isSet ? this.rating.value : undefined, + title: this.title.isSet ? this.title.value : undefined, + date: this.date.isSet ? this.date.value : undefined, + studio_id: this.studio.isSet ? this.studio.value : undefined, + performer_ids: this.performers.isSet ? this.performers.value : undefined, + tag_ids: this.tags.isSet ? this.tags.value : undefined, }; } }