mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Fix scene file name parser update (#998)
* Fix conversion of input maps * Only set changed scene values in parser update
This commit is contained in:
@@ -39,7 +39,14 @@ func getUpdateInputMaps(ctx context.Context) []map[string]interface{} {
|
|||||||
input, _ := args[updateInputField]
|
input, _ := args[updateInputField]
|
||||||
var ret []map[string]interface{}
|
var ret []map[string]interface{}
|
||||||
if input != nil {
|
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
|
return ret
|
||||||
|
|||||||
@@ -81,19 +81,12 @@ export class SceneParserResult {
|
|||||||
public toSceneUpdateInput() {
|
public toSceneUpdateInput() {
|
||||||
return {
|
return {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
details: this.scene.details,
|
rating: this.rating.isSet ? this.rating.value : undefined,
|
||||||
url: this.scene.url,
|
title: this.title.isSet ? this.title.value : undefined,
|
||||||
rating: this.rating.isSet ? this.rating.value : this.scene.rating,
|
date: this.date.isSet ? this.date.value : undefined,
|
||||||
gallery_id: this.scene.gallery?.id,
|
studio_id: this.studio.isSet ? this.studio.value : undefined,
|
||||||
title: this.title.isSet ? this.title.value : this.scene.title,
|
performer_ids: this.performers.isSet ? this.performers.value : undefined,
|
||||||
date: this.date.isSet ? this.date.value : this.scene.date,
|
tag_ids: this.tags.isSet ? this.tags.value : undefined,
|
||||||
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),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user