Fix issue where player names aren't saved
This commit is contained in:
parent
6763b47509
commit
668287a7e2
@ -136,7 +136,7 @@ internal sealed class PersistenceContext
|
||||
{
|
||||
try
|
||||
{
|
||||
var updates = mappings
|
||||
var updates = mappings.DistinctBy(x => x.ContentId)
|
||||
.Where(mapping => mapping.ContentId != 0 && !string.IsNullOrEmpty(mapping.PlayerName))
|
||||
.Where(mapping =>
|
||||
{
|
||||
@ -157,7 +157,13 @@ internal sealed class PersistenceContext
|
||||
using (var scope = _serviceProvider.CreateScope())
|
||||
{
|
||||
using var dbContext = scope.ServiceProvider.GetRequiredService<RetainerTrackContext>();
|
||||
dbContext.Players.AddRange(updates);
|
||||
foreach (var update in updates)
|
||||
{
|
||||
if (!dbContext.Players.Any(x => x.LocalContentId == update.LocalContentId))
|
||||
dbContext.Players.AddRange(updates);
|
||||
}
|
||||
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
foreach (var player in updates)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Version>3.0</Version>
|
||||
<Version>3.1</Version>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
|
@ -37,7 +37,8 @@ internal sealed class RetainerTrackPlugin : IDalamudPlugin
|
||||
ServiceCollection serviceCollection = new();
|
||||
serviceCollection.AddLogging(builder => builder.SetMinimumLevel(LogLevel.Trace)
|
||||
.ClearProviders()
|
||||
.AddDalamudLogger(pluginLog));
|
||||
.AddDalamudLogger(pluginLog)
|
||||
.AddFilter("Microsoft.EntityFrameworkCore", LogLevel.Warning));
|
||||
serviceCollection.AddSingleton<IDalamudPlugin>(this);
|
||||
serviceCollection.AddSingleton(pluginInterface);
|
||||
serviceCollection.AddSingleton(framework);
|
||||
|
Loading…
Reference in New Issue
Block a user