Adds Custom DataAsset UI + Added Request buttons for RaceDatas/TeamList/Rankings request to ApiStatus Tab + Addes Tracked Requests For Rankings + Added Utils Module For Blueprint Utilities Functions
This commit is contained in:
@ -10,21 +10,31 @@ UDTFluxModelAsset::UDTFluxModelAsset(const FObjectInitializer& ObjectInitializer
|
||||
{
|
||||
}
|
||||
|
||||
void UDTFluxModelAsset::AddContest(const FDTFluxContest &Contest)
|
||||
void UDTFluxModelAsset::AddContest(const FDTFluxContest& Contest)
|
||||
{
|
||||
Contests.Add(Contest.Name, Contest);
|
||||
}
|
||||
|
||||
bool UDTFluxModelAsset::GetContestById(const int InContestId, FDTFluxContest& OutContest)
|
||||
{
|
||||
for(auto& ContestItem : Contests)
|
||||
for (auto& ContestItem : Contests)
|
||||
{
|
||||
if(ContestItem.Value.ContestId == InContestId)
|
||||
if (ContestItem.Value.ContestId == InContestId)
|
||||
{
|
||||
OutContest = ContestItem.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UDTFluxModelAsset::GetStage(FDTFluxStageKey StageKey, FDTFluxStage& OutStage)
|
||||
{
|
||||
FDTFluxContest TargetContest;
|
||||
int TargetStageId = StageKey.StageId;
|
||||
if (GetContestById(StageKey.ContestId, TargetContest))
|
||||
{
|
||||
return TargetContest.GetStage(TargetStageId, OutStage);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -36,19 +46,20 @@ void UDTFluxModelAsset::AddPerson(const FDTFluxPerson& InPerson)
|
||||
|
||||
void UDTFluxModelAsset::AddParticipant(const FDTFluxParticipant& InParticipant, const int ContestId)
|
||||
{
|
||||
UE_LOG(logDTFluxCore, Error, TEXT("%i Person in Participant %i"), InParticipant.GetTeammateNum(), InParticipant.Bib);
|
||||
UE_LOG(logDTFluxCore, Error, TEXT("%i Person in Participant %i"), InParticipant.GetTeammateNum(),
|
||||
InParticipant.Bib);
|
||||
FDTFluxContest TargetContest;
|
||||
if(GetContestById(ContestId, TargetContest))
|
||||
if (GetContestById(ContestId, TargetContest))
|
||||
{
|
||||
TArray<FDTFluxPerson> Teammate = InParticipant.Teammate;
|
||||
for(auto& Person : InParticipant.Teammate)
|
||||
for (auto& Person : InParticipant.Teammate)
|
||||
{
|
||||
UE_LOG(logDTFluxCore, Error, TEXT("AddParticipant() DTFlux Person %s %s %s"),
|
||||
*Person.FirstName, *Person.LastName, *Person.Gender);
|
||||
if(!PersonExists(Person))
|
||||
*Person.FirstName, *Person.LastName, *Person.Gender);
|
||||
if (!PersonExists(Person))
|
||||
{
|
||||
UE_LOG(logDTFluxCore, Error, TEXT("AddParticipant() DTFlux Person %s %s %s doesnot exists, adding..."),
|
||||
*Person.FirstName, *Person.LastName, *Person.Gender);
|
||||
*Person.FirstName, *Person.LastName, *Person.Gender);
|
||||
AddPerson(Person);
|
||||
}
|
||||
}
|
||||
@ -68,10 +79,11 @@ bool UDTFluxModelAsset::PersonExists(const FDTFluxPerson& InPerson) const
|
||||
FString UDTFluxModelAsset::GetContestNameForId(const int InContestID)
|
||||
{
|
||||
FDTFluxContest Contest;
|
||||
if(!GetContestById(InContestID, Contest))
|
||||
if (!GetContestById(InContestID, Contest))
|
||||
{
|
||||
UE_LOG(logDTFluxCore, Warning, TEXT("GetContestNameForId(%i) [unable to find a contest] result will be empty !!!"),
|
||||
InContestID);
|
||||
UE_LOG(logDTFluxCore, Warning,
|
||||
TEXT("GetContestNameForId(%i) [unable to find a contest] result will be empty !!!"),
|
||||
InContestID);
|
||||
}
|
||||
return Contest.Name;
|
||||
}
|
||||
@ -85,7 +97,7 @@ void UDTFluxModelAsset::UpdateParticipant(const FDTFluxParticipant& Participant)
|
||||
{
|
||||
// TODO : If update is on Bib we are totally lost as we search by bib.
|
||||
int Bib = Participant.Bib;
|
||||
if(Participants.Contains(Bib))
|
||||
if (Participants.Contains(Bib))
|
||||
{
|
||||
TArray<FDTFluxPerson> InTeammate = Participant.Teammate;
|
||||
Participants[Bib].Elite = Participant.Elite;
|
||||
@ -95,7 +107,7 @@ void UDTFluxModelAsset::UpdateParticipant(const FDTFluxParticipant& Participant)
|
||||
Participants[Bib].Team = Participant.Team;
|
||||
Participants[Bib].Status = Participant.Status;
|
||||
//TODO : Update Person
|
||||
for(const auto& Person : InTeammate)
|
||||
for (const auto& Person : InTeammate)
|
||||
{
|
||||
//Don't know what to do...
|
||||
}
|
||||
@ -104,12 +116,23 @@ void UDTFluxModelAsset::UpdateParticipant(const FDTFluxParticipant& Participant)
|
||||
|
||||
void UDTFluxModelAsset::UpdateParticipantStatus(const FDTFluxTeamStatusUpdate& NewParticipantStatus)
|
||||
{
|
||||
if(Participants.Contains(NewParticipantStatus.Bib))
|
||||
if (Participants.Contains(NewParticipantStatus.Bib))
|
||||
{
|
||||
Participants[NewParticipantStatus.Bib].Status = NewParticipantStatus.Status;
|
||||
}
|
||||
}
|
||||
|
||||
bool UDTFluxModelAsset::GetParticipantByBib(int Bib, FDTFluxParticipant& OutParticipant)
|
||||
{
|
||||
if (Participants.Contains(Bib))
|
||||
{
|
||||
OutParticipant = Participants[Bib];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void UDTFluxModelAsset::UpdateOrCreateStageRanking(const FDTFluxStageRankings& InStageRankings)
|
||||
{
|
||||
FDTFluxStageKey StageKey = InStageRankings.GetCompositeKey();
|
||||
|
||||
Reference in New Issue
Block a user