Ranking reforge. SplitRanking is not implemented yet !!!

This commit is contained in:
2025-06-30 19:02:19 +02:00
parent 81bf37639b
commit 11e695f379
13 changed files with 218 additions and 104 deletions

View File

@ -6,37 +6,6 @@
#include "Types/Objects/DTFluxContestStorage.h"
// const FDateTime UDTFluxModelAsset::GetMassStart(const int& ContestId, const int& StageId)
// {
// }
// void UDTFluxModelAsset::InsertOrUpdateRaceData(const TSharedPtr<FJsonObject>& Response)
// {
//
// }
//
// void UDTFluxModelAsset::InsertOrUpdateContestRanking(const TSharedPtr<FJsonObject>& Response)
// {
// }
//
// void UDTFluxModelAsset::InsertOrUpdateStageRanking(const TSharedPtr<FJsonObject>& Response)
// {
// }
//
// void UDTFluxModelAsset::InsertOrUpdateSplitRanking(const TSharedPtr<FJsonObject>& Response)
// {
// }
//
// void UDTFluxModelAsset::InsertOrUpdateTeamList(const TSharedPtr<FJsonObject>& Response)
// {
// }
//
// void UDTFluxModelAsset::SplitSensorTriggered(const TSharedPtr<FJsonObject>& Response)
// {
// }
UDTFluxModelAsset::UDTFluxModelAsset(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
}
@ -93,3 +62,47 @@ bool UDTFluxModelAsset::PersonExists(const FDTFluxPerson& InPerson) const
return Person == InPerson;
});
}
FString UDTFluxModelAsset::GetContestNameForId(const int InContestID)
{
FDTFluxContest Contest;
if(!GetContestById(InContestID, Contest))
{
UE_LOG(logDTFluxCore, Warning, TEXT("GetContestNameForId(%i) [unable to find a contest] result will be empty !!!"),
InContestID);
}
return Contest.Name;
}
void UDTFluxModelAsset::AddContestRanking(const FDTFluxContestRankings& NewContestRankings)
{
ContestRankings.Add(NewContestRankings.ContestId, NewContestRankings);
}
bool UDTFluxModelAsset::UpdateStageRanking(const FDTFluxStageRankings& InStageRankings)
{
const int ContestId = InStageRankings.ContestId;
const int StageId = InStageRankings.StageId;
int Index = 0;
int StageRankingArraySize = StageRankings.Num()-1;
for(auto Ranking : StageRankings)
{
if(Ranking.ContestId == ContestId && Ranking.StageId == StageId)
{
Index++;
break;
}
Index++;
}
if(Index != StageRankingArraySize )
{
StageRankings[Index] = InStageRankings;
return true;
}
return false;
}
bool UDTFluxModelAsset::UpdateSplitRanking(const FDTFluxStageRankings& InStageRankings)
{
return true;
}