From 3b8e177ba816ff8f2713780801edd3366d96ab66 Mon Sep 17 00:00:00 2001 From: JPVenson Date: Wed, 13 Nov 2024 01:08:20 +0000 Subject: [PATCH] Removed duplicated code --- .../Item/PeopleRepository.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs index 38f699c15c..e22fd0806c 100644 --- a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs +++ b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs @@ -70,6 +70,10 @@ public class PeopleRepository(IDbContextFactory dbProvider, I context.Peoples.Add(personEntity); existingEntity = personEntity; } + else + { + context.Peoples.Attach(personEntity).State = EntityState.Modified; + } context.PeopleBaseItemMap.Add(new PeopleBaseItemMap() { @@ -83,18 +87,6 @@ public class PeopleRepository(IDbContextFactory dbProvider, I }); } - foreach (var person in people.Select(Map)) - { - if (context.Peoples.Any(f => f.Id == person.Id)) - { - context.Peoples.Attach(person).State = EntityState.Modified; - } - else - { - context.Peoples.Add(person); - } - } - context.SaveChanges(); transaction.Commit(); }