diff --git a/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp b/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp index b44599d4092a4e671a66f36088c72e3faf0880da..15f0a96f9726ffc1c9ceef6ebda2e9e55632b149 100644 --- a/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp +++ b/Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp @@ -282,25 +282,31 @@ void USFGameInstance::PrepareWithStudySetup(ASFStudySetup* Setup) FString ParticipantID = ""; if(Setup->bUseCustomParticipantIDs) { - //ask for it: - bool bValidIDEntered = false; - while(!bValidIDEntered) - { - FString IDGiven; - int Result = FSFUtils::OpenCustomDialogText("Participant ID", "Please type in your ID:", "", IDGiven); - if (Result < 0) { - FSFLoggingUtils::Log("[USFGameInstance::PrepareWithStudySetup] The window for entering the participant ID was closed without giving an answer, repeat question!", false); - continue; - } - //check whether it was used before - if(USFParticipant::WasParticipantIdAlreadyUsed(IDGiven)) - { - FSFUtils::OpenMessageBox("Participant ID \"" + IDGiven + "\"was already used, you have to choose another one!"); - } - else + //if we arerecovering, restore it: + if (bRecoverParticipantData) { + ParticipantID = USFParticipant::GetLastParticipantID(); + } + else { + //ask for it: + bool bValidIDEntered = false; + while (!bValidIDEntered) { - ParticipantID = IDGiven; - bValidIDEntered = true; + FString IDGiven; + int Result = FSFUtils::OpenCustomDialogText("Participant ID", "Please type in your ID:", "", IDGiven); + if (Result < 0) { + FSFLoggingUtils::Log("[USFGameInstance::PrepareWithStudySetup] The window for entering the participant ID was closed without giving an answer, repeat question!", false); + continue; + } + //check whether it was used before + if (USFParticipant::WasParticipantIdAlreadyUsed(IDGiven)) + { + FSFUtils::OpenMessageBox("Participant ID \"" + IDGiven + "\"was already used, you have to choose another one!"); + } + else + { + ParticipantID = IDGiven; + bValidIDEntered = true; + } } } }