fixed errors while logging raids

SQlite is now also used in production
This commit is contained in:
Sarah Faey 2022-11-24 17:56:06 +01:00
parent 7d6bc48dba
commit fc5e75cc9d
5 changed files with 12 additions and 20 deletions

View file

@ -58,9 +58,6 @@ namespace Lieb.Data
if (raid.RaidId == 0)
{
context.Raids.Add(raid);
RaidLog log = RaidLog.CreateRaidLog(changedBy, raid);
await context.RaidLogs.AddAsync(log);
await context.SaveChangesAsync();
}
else
{
@ -79,11 +76,11 @@ namespace Lieb.Data
}
context.RaidRoles.RemoveRange(raid.Roles.Where(r => !r.IsRandomSignUpRole));
}
RaidLog log = RaidLog.CreateRaidLog(changedBy, raid);
await context.RaidLogs.AddAsync(log);
await context.SaveChangesAsync();
}
await context.SaveChangesAsync();
RaidLog log = RaidLog.CreateRaidLog(changedBy, raid);
await context.RaidLogs.AddAsync(log);
await context.SaveChangesAsync();
await _discordService.PostRaidMessage(raid.RaidId);
}
}

View file

@ -39,8 +39,6 @@ namespace Lieb.Data
if (template.RaidTemplateId == 0)
{
context.RaidTemplates.Add(template);
RaidLog log = RaidLog.CreateRaidTemplateLog(changedBy, template);
await context.RaidLogs.AddAsync(log);
}
else
{
@ -48,10 +46,11 @@ namespace Lieb.Data
context.RaidRoles.RemoveRange(rolesToDelete);
context.RaidReminders.RemoveRange(remindersToDelete);
context.DiscordRaidMessages.RemoveRange(messagesToDelete);
RaidLog log = RaidLog.CreateRaidTemplateLog(changedBy, template);
await context.RaidLogs.AddAsync(log);
}
await context.SaveChangesAsync();
RaidLog log = RaidLog.CreateRaidTemplateLog(changedBy, template);
await context.RaidLogs.AddAsync(log);
await context.SaveChangesAsync();
}
}