mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-06-01 13:42:28 +00:00
Fix LBP1 minimum players
This commit is contained in:
parent
79be3e175b
commit
54a61570bd
2 changed files with 26 additions and 0 deletions
|
@ -96,6 +96,12 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
slot.FirstUploaded = TimeHelper.UnixTimeMilliseconds();
|
||||
slot.LastUpdated = TimeHelper.UnixTimeMilliseconds();
|
||||
|
||||
if (slot.MinimumPlayers == 0 || slot.MaximumPlayers == 0)
|
||||
{
|
||||
slot.MinimumPlayers = 1;
|
||||
slot.MaximumPlayers = 4;
|
||||
}
|
||||
|
||||
this.database.Slots.Add(slot);
|
||||
await this.database.SaveChangesAsync();
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ namespace LBPUnion.ProjectLighthouse
|
|||
Logger.Log("Fixing broken timestamps...", LoggerLevelDatabase.Instance);
|
||||
FixTimestamps(database);
|
||||
|
||||
Logger.Log("Fixing old LBP1 MinimumPlayers columns", LoggerLevelDatabase.Instance);
|
||||
FixMinimumPlayers(database);
|
||||
|
||||
stopwatch.Stop();
|
||||
Logger.Log($"Ready! Startup took {stopwatch.ElapsedMilliseconds}ms. Passing off control to ASP.NET...", LoggerLevelStartup.Instance);
|
||||
|
||||
|
@ -79,6 +82,23 @@ namespace LBPUnion.ProjectLighthouse
|
|||
Logger.Log($"Fixing timestamps took {stopwatch.ElapsedMilliseconds}ms.", LoggerLevelDatabase.Instance);
|
||||
}
|
||||
|
||||
public static void FixMinimumPlayers(Database database)
|
||||
{
|
||||
Stopwatch stopwatch = new();
|
||||
stopwatch.Start();
|
||||
|
||||
foreach (Slot slot in database.Slots.Where(s => s.MinimumPlayers == 0))
|
||||
{
|
||||
slot.MinimumPlayers = 1;
|
||||
slot.MaximumPlayers = 4;
|
||||
}
|
||||
|
||||
database.SaveChanges();
|
||||
|
||||
stopwatch.Stop();
|
||||
Logger.Log($"Fixing minimum players took {stopwatch.ElapsedMilliseconds}ms.", LoggerLevelDatabase.Instance);
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||
=> Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue