Renamed PlannedRaidRole to RaidRole
This commit is contained in:
parent
7533d5a704
commit
dcdc891925
17 changed files with 65 additions and 46 deletions
|
@ -158,11 +158,11 @@ namespace Lieb.Data
|
|||
|
||||
var signUps = new RaidSignUp[]
|
||||
{
|
||||
new RaidSignUp{GuildWars2AccountId = linaith.GuildWars2AccountId, LiebUserId = users[0].LiebUserId, PlannedRaidRoleId = ele.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.SignedUp },
|
||||
new RaidSignUp{GuildWars2AccountId = hierpiepts.GuildWars2AccountId, LiebUserId = users[1].LiebUserId, PlannedRaidRoleId = flexTest1.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.SignedUp },
|
||||
new RaidSignUp{GuildWars2AccountId = bloodseeker.GuildWars2AccountId, LiebUserId = users[2].LiebUserId, PlannedRaidRoleId = flexTest2.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.SignedUp },
|
||||
new RaidSignUp{GuildWars2AccountId = hierpiepts.GuildWars2AccountId, LiebUserId = users[1].LiebUserId, PlannedRaidRoleId = flexTest2.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.Flex },
|
||||
new RaidSignUp{GuildWars2AccountId = bloodseeker.GuildWars2AccountId, LiebUserId = users[2].LiebUserId, PlannedRaidRoleId = flexTest3.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.Flex }
|
||||
new RaidSignUp{GuildWars2AccountId = linaith.GuildWars2AccountId, LiebUserId = users[0].LiebUserId, RaidRoleId = ele.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.SignedUp },
|
||||
new RaidSignUp{GuildWars2AccountId = hierpiepts.GuildWars2AccountId, LiebUserId = users[1].LiebUserId, RaidRoleId = flexTest1.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.SignedUp },
|
||||
new RaidSignUp{GuildWars2AccountId = bloodseeker.GuildWars2AccountId, LiebUserId = users[2].LiebUserId, RaidRoleId = flexTest2.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.SignedUp },
|
||||
new RaidSignUp{GuildWars2AccountId = hierpiepts.GuildWars2AccountId, LiebUserId = users[1].LiebUserId, RaidRoleId = flexTest2.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.Flex },
|
||||
new RaidSignUp{GuildWars2AccountId = bloodseeker.GuildWars2AccountId, LiebUserId = users[2].LiebUserId, RaidRoleId = flexTest3.RaidRoleId, RaidId = raid.RaidId, SignUpType = SignUpType.Flex }
|
||||
};
|
||||
|
||||
context.RaidSignUps.AddRange(signUps);
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace Lieb.Data
|
|||
public DbSet<RaidReminder> RaidReminders { get; set; }
|
||||
public DbSet<RaidSignUp> RaidSignUps { get; set; }
|
||||
public DbSet<RaidSignUpHistory> RaidSignUpHistories { get; set; }
|
||||
public DbSet<DiscordRaidMessage> DiscordRaidMessages { get; set; }
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
|
@ -41,6 +42,7 @@ namespace Lieb.Data
|
|||
modelBuilder.Entity<RaidReminder>().ToTable("RaidReminder");
|
||||
modelBuilder.Entity<RaidSignUp>().ToTable("RaidSignUp");
|
||||
modelBuilder.Entity<RaidSignUpHistory>().ToTable("RaidSignUpHistory");
|
||||
modelBuilder.Entity<DiscordRaidMessage>().ToTable("DiscordRaidMessage");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Lieb.Data
|
|||
.ThenInclude(a => a.EquippedBuilds)
|
||||
.ThenInclude(e => e.GuildWars2Build)
|
||||
.Include(r => r.SignUps)
|
||||
.ThenInclude(s => s.PlannedRaidRole)
|
||||
.ThenInclude(s => s.RaidRole)
|
||||
.FirstOrDefault(r => r.RaidId == raidId);
|
||||
|
||||
if (raid == null || raid.RaidType == RaidType.Planned)
|
||||
|
@ -71,7 +71,7 @@ namespace Lieb.Data
|
|||
role.Name = "No class found.";
|
||||
}
|
||||
raid.Roles.Add(role);
|
||||
signUp.PlannedRaidRole = role;
|
||||
signUp.RaidRole = role;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace Lieb.Data
|
|||
role.Name = "No class found.";
|
||||
}
|
||||
raid.Roles.Add(role);
|
||||
signUp.PlannedRaidRole = role;
|
||||
signUp.RaidRole = role;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ namespace Lieb.Data
|
|||
role.Name = userBuild.Value.BuildName;
|
||||
raid.Roles.Add(role);
|
||||
RaidSignUp signUp = raid.SignUps.FirstOrDefault(s => s.LiebUserId == userBuild.Key);
|
||||
signUp.PlannedRaidRole = role;
|
||||
signUp.RaidRole = role;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ namespace Lieb.Data
|
|||
List<RaidRole> rolesToDelete = new List<RaidRole>();
|
||||
foreach (RaidRole role in raid.Roles)
|
||||
{
|
||||
if (!role.IsRandomSignUpRole && raid.SignUps.FirstOrDefault(s => s.PlannedRaidRoleId == role.RaidRoleId) == null)
|
||||
if (!role.IsRandomSignUpRole && raid.SignUps.FirstOrDefault(s => s.RaidRoleId == role.RaidRoleId) == null)
|
||||
{
|
||||
rolesToDelete.Add(role);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Lieb.Data
|
|||
.Include(r => r.SignUps)
|
||||
.ThenInclude(s => s.GuildWars2Account)
|
||||
.Include(r => r.SignUps)
|
||||
.ThenInclude(s => s.PlannedRaidRole)
|
||||
.ThenInclude(s => s.RaidRole)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace Lieb.Data
|
|||
.Include(r => r.SignUps)
|
||||
.ThenInclude(s => s.GuildWars2Account)
|
||||
.Include(r => r.SignUps)
|
||||
.ThenInclude(s => s.PlannedRaidRole)
|
||||
.ThenInclude(s => s.RaidRole)
|
||||
.FirstOrDefault(r => r.RaidId == raidId);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace Lieb.Data
|
|||
RaidRole randomRole = raid.Roles.FirstOrDefault(r => r.IsRandomSignUpRole);
|
||||
foreach (RaidSignUp signUp in raid.SignUps)
|
||||
{
|
||||
signUp.PlannedRaidRole = randomRole;
|
||||
signUp.RaidRole = randomRole;
|
||||
}
|
||||
context.RaidRoles.RemoveRange(raid.Roles.Where(r => !r.IsRandomSignUpRole));
|
||||
}
|
||||
|
@ -103,14 +103,14 @@ namespace Lieb.Data
|
|||
{
|
||||
ChangeSignUpType(raidId, liebUserId, plannedRoleId, signUpType);
|
||||
}
|
||||
else if (!signUps.Where(r => r.PlannedRaidRoleId == plannedRoleId).Any())
|
||||
else if (!signUps.Where(r => r.RaidRoleId == plannedRoleId).Any())
|
||||
{
|
||||
context.RaidSignUps.Add(new RaidSignUp()
|
||||
{
|
||||
GuildWars2AccountId = guildWars2AccountId,
|
||||
RaidId = raidId,
|
||||
LiebUserId = liebUserId,
|
||||
PlannedRaidRoleId = plannedRoleId,
|
||||
RaidRoleId = plannedRoleId,
|
||||
SignUpType = signUpType
|
||||
});
|
||||
await context.SaveChangesAsync();
|
||||
|
@ -132,10 +132,10 @@ namespace Lieb.Data
|
|||
|
||||
//change and delete Role for Random Raids
|
||||
Raid? raid = context.Raids.Include(r => r.Roles).FirstOrDefault(r => r.RaidId == raidId);
|
||||
if(raid != null && raid.RaidType != RaidType.Planned && !signUp.PlannedRaidRole.IsRandomSignUpRole)
|
||||
if(raid != null && raid.RaidType != RaidType.Planned && !signUp.RaidRole.IsRandomSignUpRole)
|
||||
{
|
||||
context.RaidRoles.Remove(signUp.PlannedRaidRole);
|
||||
signUp.PlannedRaidRole = raid.Roles.FirstOrDefault(r => r.IsRandomSignUpRole);
|
||||
context.RaidRoles.Remove(signUp.RaidRole);
|
||||
signUp.RaidRole = raid.Roles.FirstOrDefault(r => r.IsRandomSignUpRole);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,18 +165,18 @@ namespace Lieb.Data
|
|||
List<RaidSignUp> signUps = context.RaidSignUps.Where(x => x.RaidId == raidId && x.LiebUserId == liebUserId).ToList();
|
||||
|
||||
RaidSignUp? signUp = signUps.FirstOrDefault(x => x.SignUpType != SignUpType.Flex);
|
||||
RaidSignUp? flexSignUp = signUps.FirstOrDefault(x => x.SignUpType == SignUpType.Flex && x.PlannedRaidRoleId == plannedRoleId);
|
||||
RaidSignUp? flexSignUp = signUps.FirstOrDefault(x => x.SignUpType == SignUpType.Flex && x.RaidRoleId == plannedRoleId);
|
||||
|
||||
//change Flex to current role
|
||||
if (flexSignUp != null && signUp != null)
|
||||
{
|
||||
flexSignUp.PlannedRaidRoleId = signUp.PlannedRaidRoleId;
|
||||
flexSignUp.RaidRoleId = signUp.RaidRoleId;
|
||||
}
|
||||
|
||||
//change to new role
|
||||
if (signUp != null)
|
||||
{
|
||||
signUp.PlannedRaidRoleId = plannedRoleId;
|
||||
signUp.RaidRoleId = plannedRoleId;
|
||||
signUp.SignUpType = signUpType;
|
||||
}
|
||||
context.SaveChanges();
|
||||
|
@ -191,7 +191,7 @@ namespace Lieb.Data
|
|||
|
||||
using var context = _contextFactory.CreateDbContext();
|
||||
|
||||
List<RaidSignUp> signUps = context.RaidSignUps.Where(s => s.PlannedRaidRoleId == plannedRoleId).ToList();
|
||||
List<RaidSignUp> signUps = context.RaidSignUps.Where(s => s.RaidRoleId == plannedRoleId).ToList();
|
||||
|
||||
RaidRole? role = context.RaidRoles
|
||||
.FirstOrDefault(r => r.RaidRoleId == plannedRoleId);
|
||||
|
@ -237,9 +237,9 @@ namespace Lieb.Data
|
|||
// new sign up is available if there are free spots and the user is not signed up or still in the random role
|
||||
RaidSignUp? signUp = raid.SignUps.FirstOrDefault(s => s.LiebUserId == liebUserId);
|
||||
return raid.SignUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count() < role.Spots
|
||||
&& (signUp == null || signUp.PlannedRaidRoleId == plannedRoleId || signUp.SignUpType == SignUpType.SignedOff);
|
||||
&& (signUp == null || signUp.RaidRoleId == plannedRoleId || signUp.SignUpType == SignUpType.SignedOff);
|
||||
}
|
||||
return raid.SignUps.Where(s => s.LiebUserId == liebUserId && s.PlannedRaidRoleId == plannedRoleId).Any();
|
||||
return raid.SignUps.Where(s => s.LiebUserId == liebUserId && s.RaidRoleId == plannedRoleId).Any();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,16 +257,16 @@ namespace Lieb.Data
|
|||
return false;
|
||||
}
|
||||
|
||||
foreach (int userId in raid.SignUps.Where(s => s.PlannedRaidRoleId == plannedRoleId && s.SignUpType == SignUpType.SignedUp).Select(s => s.LiebUserId))
|
||||
foreach (int userId in raid.SignUps.Where(s => s.RaidRoleId == plannedRoleId && s.SignUpType == SignUpType.SignedUp).Select(s => s.LiebUserId))
|
||||
{
|
||||
foreach (RaidSignUp signUp in raid.SignUps.Where(s => s.LiebUserId == userId && s.SignUpType == SignUpType.Flex))
|
||||
{
|
||||
if (!checkedRoleIds.Contains(signUp.PlannedRaidRoleId)
|
||||
&& await IsRoleSignUpAllowed(raid, userId, signUp.PlannedRaidRoleId, SignUpType.SignedUp, moveFlexUser, checkedRoleIds))
|
||||
if (!checkedRoleIds.Contains(signUp.RaidRoleId)
|
||||
&& await IsRoleSignUpAllowed(raid, userId, signUp.RaidRoleId, SignUpType.SignedUp, moveFlexUser, checkedRoleIds))
|
||||
{
|
||||
if (moveFlexUser)
|
||||
{
|
||||
ChangeSignUpType(raid.RaidId, userId, signUp.PlannedRaidRoleId, SignUpType.SignedUp);
|
||||
ChangeSignUpType(raid.RaidId, userId, signUp.RaidRoleId, SignUpType.SignedUp);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
@inject IJSRuntime JsRuntime
|
||||
|
||||
|
||||
<h3>BuildEdit</h3>
|
||||
<h3>Build Edit</h3>
|
||||
|
||||
<AuthorizeView Policy="@Constants.Roles.Admin.Name" Context="authorizationContext">
|
||||
<EditForm Model="@_build" OnValidSubmit="@HandleValidSubmit">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
@inject GuildWars2BuildService GuildWars2BuildService
|
||||
|
||||
|
||||
<h3>BuildOverview</h3>
|
||||
<h3>Build Overview</h3>
|
||||
|
||||
|
||||
<AuthorizeView Policy="@Constants.Roles.Admin.Name">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
|
||||
<h3>RaidLogs</h3>
|
||||
<h3>Raid Logs</h3>
|
||||
|
||||
<select value=@_selectedLogFolder @onchange="args => ChangeShownLogs(args)">
|
||||
@if (_logGroups.Contains(TRAINING))
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
@inject IJSRuntime JsRuntime
|
||||
|
||||
|
||||
<h3>CreateRaid</h3>
|
||||
<h3>Create Raid</h3>
|
||||
|
||||
<AuthorizeView Policy="@Constants.Roles.RaidLead.Name" Context="authorizationContext">
|
||||
<EditForm Model="@_raid" OnValidSubmit="@HandleValidSubmit">
|
||||
|
@ -128,7 +128,7 @@
|
|||
</tr>
|
||||
@foreach( RaidRole role in _raid.Roles)
|
||||
{
|
||||
bool disableEdit = _raid.SignUps.Where(s => s.PlannedRaidRoleId == role.RaidRoleId).Any();
|
||||
bool disableEdit = _raid.SignUps.Where(s => s.RaidRoleId == role.RaidRoleId).Any();
|
||||
<tr>
|
||||
<td><InputNumber @bind-Value="role.Spots" disabled="@disableEdit" /></td>
|
||||
<td><InputText @bind-Value="role.Name" disabled="@disableEdit" /></td>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
|
||||
<h3>RaidOverview</h3>
|
||||
<h3>Raid Overview</h3>
|
||||
|
||||
|
||||
<AuthorizeView Policy="@Constants.Roles.RaidLead.Name">
|
||||
|
@ -21,11 +21,11 @@
|
|||
|
||||
<br />
|
||||
<label>
|
||||
Filter From:
|
||||
From:
|
||||
<input type="date" value="@_startDate.ToString("yyyy-MM-dd")" @onchange="args => StartFilterChanged(args)" />
|
||||
To:
|
||||
<input type="date" value="@_endDate.ToString("yyyy-MM-dd")" @onchange="args => EndFilterChanged(args)" />
|
||||
RaidGroup:
|
||||
Raid Group:
|
||||
<select @onchange="args => GroupFilterChanged(args)" >
|
||||
<option value="">All</option>
|
||||
<option value="No Group">No Group</option>
|
||||
|
@ -73,13 +73,23 @@
|
|||
|
||||
private void StartFilterChanged(ChangeEventArgs e)
|
||||
{
|
||||
_startDate = DateTime.Parse(e.Value.ToString());
|
||||
if(!DateTime.TryParse(e.Value.ToString(), out _startDate))
|
||||
{
|
||||
_startDate = DateTime.UnixEpoch;
|
||||
}
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
private void EndFilterChanged(ChangeEventArgs e)
|
||||
{
|
||||
_endDate = DateTime.Parse(e.Value.ToString()).AddDays(1).AddSeconds(-1);
|
||||
if(DateTime.TryParse(e.Value.ToString(), out _endDate))
|
||||
{
|
||||
_endDate.AddDays(1).AddSeconds(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_endDate = DateTime.MaxValue.Date;
|
||||
}
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
|
|
7
Lieb/Pages/Raids/RaidOverview.razor.css
Normal file
7
Lieb/Pages/Raids/RaidOverview.razor.css
Normal file
|
@ -0,0 +1,7 @@
|
|||
body {
|
||||
}
|
||||
|
||||
input {
|
||||
margin-right: 20px;
|
||||
width: fit-content;
|
||||
}
|
|
@ -46,7 +46,7 @@
|
|||
{
|
||||
<span class="oi oi-chevron-bottom" style="margin-right:7px"> </span>
|
||||
}
|
||||
<b>@role.Role.Name</b> (@_raid.SignUps.Where(s => s.PlannedRaidRoleId == role.Role.RaidRoleId && s.SignUpType == SignUpType.SignedUp).Count() / @role.Role.Spots)
|
||||
<b>@role.Role.Name</b> (@_raid.SignUps.Where(s => s.RaidRoleId == role.Role.RaidRoleId && s.SignUpType == SignUpType.SignedUp).Count() / @role.Role.Spots)
|
||||
@if (@role.IsRowExpanded)
|
||||
{
|
||||
<br> @role.Role.Description
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
|
||||
<table>
|
||||
@{RaidSignUp[] signUps = _raid.SignUps.Where(s => s.PlannedRaidRoleId == _currentRoleId).ToArray();}
|
||||
@{RaidSignUp[] signUps = _raid.SignUps.Where(s => s.RaidRoleId == _currentRoleId).ToArray();}
|
||||
@foreach (var signUp in signUps.OrderBy(s => s.SignUpType))
|
||||
{
|
||||
@if(_signUpTypes.Contains(signUp.SignUpType))
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
@inject NavigationManager NavigationManager
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
<h3>ManageAccount</h3>
|
||||
<h3>Manage Account</h3>
|
||||
|
||||
<AuthorizeView Context="authorizationContext">
|
||||
<Authorized>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
<h3>ManageGuildWars2Account</h3>
|
||||
<h3>Manage Guild Wars 2 Account</h3>
|
||||
|
||||
<AuthorizeView Context="authorizationContext">
|
||||
<Authorized>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
<h3>UserEdit</h3>
|
||||
<h3>User Edit</h3>
|
||||
|
||||
<EditForm Model="@_user" OnValidSubmit="@HandleValidSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
@inject UserService UserService
|
||||
|
||||
|
||||
<h3>UserOverview</h3>
|
||||
<h3>User Overview</h3>
|
||||
|
||||
|
||||
<AuthorizeView Policy="@Constants.Roles.Admin.Name">
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
public int RaidId { get; set; }
|
||||
public int LiebUserId { get; set; }
|
||||
public int GuildWars2AccountId { get; set; }
|
||||
public int PlannedRaidRoleId { get; set; }
|
||||
public int RaidRoleId { get; set; }
|
||||
|
||||
public SignUpType SignUpType { get; set; }
|
||||
|
||||
public Raid Raid { get; set; }
|
||||
public LiebUser LiebUser { get; set; }
|
||||
public GuildWars2Account GuildWars2Account { get; set; }
|
||||
public RaidRole PlannedRaidRole { get; set; }
|
||||
public RaidRole RaidRole { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue