feat: add session capacity waitlist
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
namespace GmRelay.Shared.Domain;
|
||||
|
||||
public static class SessionCapacityRules
|
||||
{
|
||||
public static string DecideJoinStatus(int? maxPlayers, int activeParticipants)
|
||||
{
|
||||
if (!maxPlayers.HasValue)
|
||||
{
|
||||
return ParticipantRegistrationStatus.Active;
|
||||
}
|
||||
|
||||
return activeParticipants < maxPlayers.Value
|
||||
? ParticipantRegistrationStatus.Active
|
||||
: ParticipantRegistrationStatus.Waitlisted;
|
||||
}
|
||||
|
||||
public static bool CanPromoteWaitlistedPlayer(int? maxPlayers, int activeParticipants, int waitlistedParticipants)
|
||||
{
|
||||
if (waitlistedParticipants <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !maxPlayers.HasValue || activeParticipants < maxPlayers.Value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user