Skip to content
Snippets Groups Projects
Commit 5c642677 authored by Malte Christian Kögel's avatar Malte Christian Kögel
Browse files

When jumping into a condition directly from the HUD, also call StartStudy....

When jumping into a condition directly from the HUD, also call StartStudy. Made StartCondition const for this, but this should be fine. closes #92
parent 9039d2d8
No related branches found
No related tags found
No related merge requests found
...@@ -455,6 +455,12 @@ bool USFGameInstance::GoToCondition(const USFCondition* Condition, bool bForced ...@@ -455,6 +455,12 @@ bool USFGameInstance::GoToCondition(const USFCondition* Condition, bool bForced
FSFLoggingUtils::Log("[USFGameInstance::GoToCondition()]: Could not load next condition.", true); FSFLoggingUtils::Log("[USFGameInstance::GoToCondition()]: Could not load next condition.", true);
return false; return false;
} }
if (!bStudyStarted && !bIsStarting) {
StartCondition = Condition; //Start at this condition
bIsStarting = true; //To avoid infinite loops, when StartStudy calls GoToCondition(StartCondition)
return StartStudy();
}
GoToConditionSynced(Condition->UniqueName, bForced, Fade); GoToConditionSynced(Condition->UniqueName, bForced, Fade);
return true; return true;
} }
......
...@@ -307,19 +307,19 @@ void USFParticipant::StoreInIndependentVarLongTable() const ...@@ -307,19 +307,19 @@ void USFParticipant::StoreInIndependentVarLongTable() const
} }
} }
void USFParticipant::DeleteStoredDataForConditionFromLongTable(USFCondition* Condition) void USFParticipant::DeleteStoredDataForConditionFromLongTable(const USFCondition* Condition)
{ {
const FString Filename = FPaths::ProjectDir() + "StudyFramework/StudyLogs/Phase_" + Condition->PhaseName + ".csv"; const FString Filename = FPaths::ProjectDir() + "StudyFramework/StudyLogs/Phase_" + Condition->PhaseName + ".csv";
RemoveLinesOfConditionAndWriteToFile(Condition, Filename); RemoveLinesOfConditionAndWriteToFile(Condition, Filename);
} }
void USFParticipant::DeleteStoredTrialDataForCondition(USFCondition* Condition, USFMultipleTrialDependentVariable* DependentVariable) void USFParticipant::DeleteStoredTrialDataForCondition(const USFCondition* Condition, USFMultipleTrialDependentVariable* DependentVariable)
{ {
const FString Filename = FPaths::ProjectDir() + "StudyFramework/StudyLogs/Phase_" + Condition->PhaseName + "_" + DependentVariable->Name + ".csv"; const FString Filename = FPaths::ProjectDir() + "StudyFramework/StudyLogs/Phase_" + Condition->PhaseName + "_" + DependentVariable->Name + ".csv";
RemoveLinesOfConditionAndWriteToFile(Condition, Filename); RemoveLinesOfConditionAndWriteToFile(Condition, Filename);
} }
void USFParticipant::RemoveLinesOfConditionAndWriteToFile(USFCondition* Condition, const FString Filename) void USFParticipant::RemoveLinesOfConditionAndWriteToFile(const USFCondition* Condition, const FString Filename)
{ {
TArray<FString> Lines; TArray<FString> Lines;
TArray<FString> CleanedLines; TArray<FString> CleanedLines;
......
...@@ -218,12 +218,14 @@ protected: ...@@ -218,12 +218,14 @@ protected:
// this is used if the study should not be started from the beginning // this is used if the study should not be started from the beginning
// e.g., when starting a map directly for debugging in the editor // e.g., when starting a map directly for debugging in the editor
// or when continuing a crashed study run // or when continuing a crashed study run
USFCondition* StartCondition; const USFCondition* StartCondition;
// State of Study / GameInstance // State of Study / GameInstance
UPROPERTY(BlueprintReadOnly) UPROPERTY(BlueprintReadOnly)
bool bStudyStarted = false; bool bStudyStarted = false;
bool bIsStarting = false;
UPROPERTY(BlueprintReadOnly) UPROPERTY(BlueprintReadOnly)
bool bStudyEnded = false; bool bStudyEnded = false;
......
...@@ -82,8 +82,8 @@ public: ...@@ -82,8 +82,8 @@ public:
// recycling bin file name // recycling bin file name
void CreateLongTableBackUp(const FString PathToSrcFile) const; void CreateLongTableBackUp(const FString PathToSrcFile) const;
void StoreTrialInTrialDVLongTable(USFMultipleTrialDependentVariable* DependentVariable, TArray<FString> Values) const; void StoreTrialInTrialDVLongTable(USFMultipleTrialDependentVariable* DependentVariable, TArray<FString> Values) const;
void DeleteStoredDataForConditionFromLongTable(USFCondition* Condition); void DeleteStoredDataForConditionFromLongTable(const USFCondition* Condition);
void DeleteStoredTrialDataForCondition(USFCondition* Condition, USFMultipleTrialDependentVariable* DependentVariable); void DeleteStoredTrialDataForCondition(const USFCondition* Condition, USFMultipleTrialDependentVariable* DependentVariable);
void SetCurrentBackUpFolderName(FString BackUpFolderName); void SetCurrentBackUpFolderName(FString BackUpFolderName);
protected: protected:
...@@ -98,7 +98,7 @@ protected: ...@@ -98,7 +98,7 @@ protected:
void StoreInPhaseLongTable() const; void StoreInPhaseLongTable() const;
void StoreInIndependentVarLongTable() const; void StoreInIndependentVarLongTable() const;
void RemoveLinesOfConditionAndWriteToFile(USFCondition* Condition, FString Filename); void RemoveLinesOfConditionAndWriteToFile(const USFCondition* Condition, FString Filename);
// This is the parent folder within RecyclingBin, where backups // This is the parent folder within RecyclingBin, where backups
// of the current operation will be stored. // of the current operation will be stored.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment