mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Fix bulk add movie to scenes and autotag transaction error (#2928)
* Fix bulk add movie to scene * Fix already in transaction error for autotag
This commit is contained in:
@@ -791,6 +791,29 @@ func Test_sceneQueryBuilder_UpdatePartialRelationships(t *testing.T) {
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"add movies to empty",
|
||||
sceneIDs[sceneIdx1WithPerformer],
|
||||
models.ScenePartial{
|
||||
MovieIDs: &models.UpdateMovieIDs{
|
||||
Movies: movieScenes,
|
||||
Mode: models.RelationshipUpdateModeAdd,
|
||||
},
|
||||
},
|
||||
models.Scene{
|
||||
Movies: models.NewRelatedMovies([]models.MoviesScenes{
|
||||
{
|
||||
MovieID: movieIDs[movieIdxWithDupName],
|
||||
SceneIndex: &sceneIndex,
|
||||
},
|
||||
{
|
||||
MovieID: movieIDs[movieIdxWithStudio],
|
||||
SceneIndex: &sceneIndex2,
|
||||
},
|
||||
}),
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"add stash ids",
|
||||
sceneIDs[sceneIdxWithSpacedName],
|
||||
|
||||
@@ -442,11 +442,16 @@ func (t *scenesMoviesTable) addJoins(ctx context.Context, id int, v []models.Mov
|
||||
// only add values that are not already present
|
||||
var filtered []models.MoviesScenes
|
||||
for _, vv := range v {
|
||||
found := false
|
||||
|
||||
for _, e := range fks {
|
||||
if vv.MovieID == e.MovieID {
|
||||
continue
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
filtered = append(filtered, vv)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user