-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
155 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace FiMAdminApi.Data.Models; | ||
|
||
public class EventRanking | ||
{ | ||
[Key] | ||
public int Id { get; set; } | ||
|
||
public required Guid EventId { get; set; } | ||
public required int Rank { get; set; } | ||
public required int TeamNumber { get; set; } | ||
public IEnumerable<double>? SortOrders { get; set; } | ||
public int? Wins { get; set; } | ||
public int? Ties { get; set; } | ||
public int? Losses { get; set; } | ||
public double? QualAverage { get; set; } | ||
public int? Disqualifications { get; set; } | ||
public int? MatchesPlayed { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace FiMAdminApi.Data.Models; | ||
|
||
public class ScheduleDeviation | ||
{ | ||
[Key] | ||
public int Id { get; set; } | ||
|
||
public required Guid EventId { get; set; } | ||
public string? Description { get; set; } | ||
public required long AfterMatchId { get; set; } | ||
public virtual Match? AfterMatch { get; set; } | ||
public long? AssociatedMatchId { get; set; } | ||
public virtual Match? AssociatedMatch { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using FiMAdminApi.Clients; | ||
using FiMAdminApi.Data; | ||
using FiMAdminApi.Data.Models; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace FiMAdminApi.EventSync.Steps; | ||
|
||
public class LoadAlliances(DataContext dbContext) | ||
: EventSyncStep([EventStatus.AwaitingAlliances]) | ||
{ | ||
public override async Task RunStep(Event evt, IDataClient eventDataClient) | ||
{ | ||
//var alliances = await eventDataClient.(evt); | ||
|
||
//if (alliances.Count == 0) return; | ||
|
||
await dbContext.SaveChangesAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
using FiMAdminApi.Clients; | ||
using FiMAdminApi.Data; | ||
using FiMAdminApi.Data.Models; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace FiMAdminApi.EventSync.Steps; | ||
|
||
public class UpdateQualRankings() : EventSyncStep([EventStatus.QualsInProgress, EventStatus.AwaitingAlliances]) | ||
public class UpdateQualRankings(DataContext dbContext) | ||
: EventSyncStep([EventStatus.QualsInProgress, EventStatus.AwaitingAlliances]) | ||
{ | ||
public override Task RunStep(Event evt, IDataClient eventDataClient) | ||
public override async Task RunStep(Event evt, IDataClient eventDataClient) | ||
{ | ||
var rankings = eventDataClient.GetQualRankingsForEvent(evt); | ||
var rankings = await eventDataClient.GetQualRankingsForEvent(evt); | ||
|
||
return Task.CompletedTask; | ||
if (rankings.Count == 0) return; | ||
|
||
await dbContext.EventRankings.Where(r => r.EventId == evt.Id).ExecuteDeleteAsync(); | ||
|
||
dbContext.EventRankings.AddRange(rankings.Select(r => new EventRanking | ||
{ | ||
EventId = evt.Id, | ||
Rank = r.Rank, | ||
TeamNumber = r.TeamNumber, | ||
SortOrders = [r.SortOrder1, r.SortOrder2, r.SortOrder3, r.SortOrder4, r.SortOrder5, r.SortOrder6], | ||
Wins = r.Wins, | ||
Ties = r.Ties, | ||
Losses = r.Losses, | ||
QualAverage = r.QualAverage, | ||
Disqualifications = r.Disqualifications, | ||
MatchesPlayed = r.MatchesPlayed | ||
})); | ||
|
||
await dbContext.SaveChangesAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dev": { | ||
"FiMAdminApi_HostAddress": "http://localhost:5291" | ||
} | ||
} |