diff --git a/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp b/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp index 7c6467bdcd1a8c2abcf1716c8ee42f5f4fafd03e..01b914fdb7e41747b9d2ebfbefc785eada39390c 100644 --- a/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp +++ b/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp @@ -151,15 +151,24 @@ void USFGameInstance::RestoreLastParticipantForDebugStart(USFCondition* InStartC const FString ParticipantID = USFParticipant::GetLastParticipantID(); Participant = NewObject<USFParticipant>(this, FName(TEXT("Participant_") + ParticipantID)); - StudySetup = USFParticipant::GetLastParticipantSetup(); + StartCondition = InStartCondition; Participant->Initialize(ParticipantSequenceNumber, ParticipantID); - Participant->LoadConditionsFromJson(); - Participant->SetIndependentVariablesFromStudySetup(StudySetup); - - InitFadeHandler(StudySetup->FadeConfig); + Participant->Conditions = Participant->GetLastParticipantsConditions(); + Participant->LoadLastParticipantsIndependentVariables(); - StartCondition = InStartCondition; + Participant->RecoverStudyResultsOfFinishedConditions(); + //also delete any data of the condition that is now restarted (StartCondition) + Participant->DeleteStoredDataForConditionFromLongTable(StartCondition); + for (USFDependentVariable* DV : StartCondition->DependentVariables) + { + if (USFMultipleTrialDependentVariable* MTDV = Cast<USFMultipleTrialDependentVariable>(DV)) + { + Participant->DeleteStoredTrialDataForCondition(StartCondition, MTDV); + } + } + + InitFadeHandler(StudySetup->FadeConfig); StartStudy(); //cannot directly fade in here, since Init might not be done, so we wait a second for safety @@ -208,6 +217,7 @@ void USFGameInstance::InitFadeHandler(FFadeConfig FadeConfig) } +// When starting on the setup map, i.e. not for debugging purposes void USFGameInstance::PrepareWithStudySetup(ASFStudySetup* Setup) { StudySetup = DuplicateObject(Setup, this); diff --git a/Source/StudyFrameworkPlugin/Private/SFParticipant.cpp b/Source/StudyFrameworkPlugin/Private/SFParticipant.cpp index 2b1de151e40d72b143b7240314d139d12ff3bf7f..bc88b182654b8a8fea646a5c348b35eb98353b82 100644 --- a/Source/StudyFrameworkPlugin/Private/SFParticipant.cpp +++ b/Source/StudyFrameworkPlugin/Private/SFParticipant.cpp @@ -600,10 +600,7 @@ void USFParticipant::SetIndependentVariablesFromStudySetup(ASFStudySetup* Setup) IndependentVariablesValues.Empty(); for (auto Var : Setup->IndependentVariables) { FString Value = ""; - if (USFGameInstance::Get()->IsInDebugMode()) { - Value = "DebugRun-NoData"; - } - else if (Var->bAskedAtBeginning) { + if (Var->bAskedAtBeginning) { switch (Var->ValueType) { case EValType::TEXT: