Update Function to ensure ref is returned instead of copy for GetContest GetContestForTime
This commit is contained in:
@ -338,7 +338,8 @@ void SDTFluxStatusWidget::PopulateComboBoxItems()
|
|||||||
{
|
{
|
||||||
FString Separator = " | ";
|
FString Separator = " | ";
|
||||||
FString RootSeparator = " -> ";
|
FString RootSeparator = " -> ";
|
||||||
TArray<FDTFluxContest> DataFromSubsystem = DTFluxCore->GetContests();
|
TArray<FDTFluxContest> DataFromSubsystem = TArray<FDTFluxContest>();
|
||||||
|
DTFluxCore->GetContests(DataFromSubsystem);
|
||||||
|
|
||||||
for (const auto& Contest : DataFromSubsystem)
|
for (const auto& Contest : DataFromSubsystem)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -554,24 +554,30 @@ TArray<int> UDTFluxCoreSubsystem::GetCurrentContestsId()
|
|||||||
return GetContestsIdForTime(FDateTime::Now());
|
return GetContestsIdForTime(FDateTime::Now());
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<FDTFluxContest> UDTFluxCoreSubsystem::GetCurrentContests()
|
bool UDTFluxCoreSubsystem::GetCurrentContests(TArray<FDTFluxContest>& OutContests)
|
||||||
{
|
{
|
||||||
return GetContestsForTime(FDateTime::Now());
|
return GetContestsForTime(FDateTime::Now(), OutContests);
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<int> UDTFluxCoreSubsystem::GetContestsIdForTime(const FDateTime Time) const
|
TArray<int> UDTFluxCoreSubsystem::GetContestsIdForTime(const FDateTime Time)
|
||||||
{
|
{
|
||||||
TArray<int> Contests;
|
if (DataStorage)
|
||||||
for (const auto& Pair : DataStorage->Contests)
|
|
||||||
{
|
{
|
||||||
FDTFluxContest Contest = Pair.Value;
|
TArray<FDTFluxContest> Contests;
|
||||||
int ContestId = Contest.ContestId;
|
if (GetContestsForTime(Time, Contests))
|
||||||
if (Contest.Date < Time && Contest.EndTime > Time)
|
|
||||||
{
|
{
|
||||||
Contests.Add(ContestId);
|
TArray<int> ContestIds = TArray<int>();
|
||||||
|
for (const auto& Contest : Contests)
|
||||||
|
{
|
||||||
|
ContestIds.Add(Contest.ContestId);
|
||||||
|
}
|
||||||
|
return ContestIds;
|
||||||
}
|
}
|
||||||
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("No Contest running for Time [%s]"), *Time.ToString());
|
||||||
|
return TArray<int>();
|
||||||
}
|
}
|
||||||
return Contests;
|
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("DataStorage not available"));
|
||||||
|
return TArray<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UDTFluxCoreSubsystem::GetContestForId(const int Id, FDTFluxContest& OutContest)
|
bool UDTFluxCoreSubsystem::GetContestForId(const int Id, FDTFluxContest& OutContest)
|
||||||
@ -588,34 +594,46 @@ bool UDTFluxCoreSubsystem::GetContestForId(const int Id, FDTFluxContest& OutCont
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<FDTFluxContest> UDTFluxCoreSubsystem::GetContestsForTime(const FDateTime Time)
|
bool UDTFluxCoreSubsystem::GetContestsForTime(const FDateTime Time, TArray<FDTFluxContest>& OutContests)
|
||||||
{
|
|
||||||
TArray<FDTFluxContest> Contests;
|
|
||||||
for (const auto& Pair : DataStorage->Contests)
|
|
||||||
{
|
|
||||||
FDTFluxContest Contest = Pair.Value;
|
|
||||||
int ContestId = Contest.ContestId;
|
|
||||||
if (Contest.Date < Time && Contest.EndTime > Time)
|
|
||||||
{
|
|
||||||
Contests.Add(Contest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Contests;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UDTFluxCoreSubsystem::RequestRankingsForStages(TArray<FDTFluxStage> RequestedStages) const
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
TArray<FDTFluxContest> UDTFluxCoreSubsystem::GetContests()
|
|
||||||
{
|
{
|
||||||
if (DataStorage)
|
if (DataStorage)
|
||||||
{
|
{
|
||||||
TArray<FDTFluxContest> OutContests;
|
OutContests.Empty();
|
||||||
DataStorage->Contests.GenerateValueArray(OutContests);
|
for (const auto& Pair : DataStorage->Contests)
|
||||||
return OutContests;
|
{
|
||||||
|
FDTFluxContest Contest = Pair.Value;
|
||||||
|
int ContestId = Contest.ContestId;
|
||||||
|
|
||||||
|
//ils ont commencé.
|
||||||
|
if (Contest.Date < Time && Contest.EndTime > Time)
|
||||||
|
{
|
||||||
|
// ils sont finis
|
||||||
|
if (!Contest.IsFinished())
|
||||||
|
{
|
||||||
|
OutContests.Add(Contest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!OutContests.IsEmpty())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("No Contest running for Time [%s]"), *Time.ToString());
|
||||||
}
|
}
|
||||||
return TArray<FDTFluxContest>();
|
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("DataStorage not available"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UDTFluxCoreSubsystem::GetContests(TArray<FDTFluxContest>& OutContests)
|
||||||
|
{
|
||||||
|
OutContests.Empty();
|
||||||
|
if (DataStorage)
|
||||||
|
{
|
||||||
|
DataStorage->Contests.GenerateValueArray(OutContests);
|
||||||
|
return !OutContests.IsEmpty();
|
||||||
|
}
|
||||||
|
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("DataStorage not available"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDTFluxCoreSubsystem::GetContest(const int ContestId, FDTFluxContest& OutContest)
|
void UDTFluxCoreSubsystem::GetContest(const int ContestId, FDTFluxContest& OutContest)
|
||||||
|
|||||||
@ -107,20 +107,18 @@ public:
|
|||||||
TArray<FGuid> TrackedRequestSplitRankings(const TArray<FDTFluxSplitKey> ForSplits, bool bEnableCache = true);
|
TArray<FGuid> TrackedRequestSplitRankings(const TArray<FDTFluxSplitKey> ForSplits, bool bEnableCache = true);
|
||||||
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||||
bool GetParticipant(int InBib, FDTFluxParticipant& OutParticipant);
|
bool GetParticipant(int InBib, FDTFluxParticipant& OutParticipant);
|
||||||
UFUNCTION()
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||||
TArray<int> GetCurrentContestsId();
|
TArray<int> GetCurrentContestsId();
|
||||||
UFUNCTION()
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||||
TArray<FDTFluxContest> GetCurrentContests();
|
bool GetCurrentContests(TArray<FDTFluxContest>& OutContests);
|
||||||
UFUNCTION()
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||||
TArray<int> GetContestsIdForTime(const FDateTime Time) const;
|
TArray<int> GetContestsIdForTime(const FDateTime Time);
|
||||||
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||||
bool GetContestForId(const int Id, FDTFluxContest& OutContest);
|
bool GetContestForId(const int Id, FDTFluxContest& OutContest);
|
||||||
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||||
TArray<FDTFluxContest> GetContestsForTime(const FDateTime Time);
|
bool GetContestsForTime(const FDateTime Time, TArray<FDTFluxContest>& OutContests);
|
||||||
UFUNCTION()
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||||
void RequestRankingsForStages(const TArray<FDTFluxStage> RequestedStages) const;
|
bool GetContests(TArray<FDTFluxContest>& OutContests);
|
||||||
UFUNCTION()
|
|
||||||
TArray<FDTFluxContest> GetContests();
|
|
||||||
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||||
void GetContest(const int ContestId, FDTFluxContest& OutContest);
|
void GetContest(const int ContestId, FDTFluxContest& OutContest);
|
||||||
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||||
|
|||||||
Reference in New Issue
Block a user