Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
StudyFramework Plugin
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
Unreal-Development
Plugins
StudyFramework Plugin
Commits
e92f2007
Commit
e92f2007
authored
2 years ago
by
Jonathan Ehret
Browse files
Options
Downloads
Patches
Plain Diff
sanitize logged data to not make problems in csv files
parent
c700a424
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/StudyFrameworkPlugin/Private/SFCondition.cpp
+21
-4
21 additions, 4 deletions
Source/StudyFrameworkPlugin/Private/SFCondition.cpp
Source/StudyFrameworkPlugin/Public/SFCondition.h
+2
-0
2 additions, 0 deletions
Source/StudyFrameworkPlugin/Public/SFCondition.h
with
23 additions
and
4 deletions
Source/StudyFrameworkPlugin/Private/SFCondition.cpp
+
21
−
4
View file @
e92f2007
...
...
@@ -112,8 +112,9 @@ bool USFCondition::StoreDependentVariableData(const FString& VarName, const FStr
{
return
false
;
}
DependentVariable
->
Value
=
Value
;
FString
SanitizedValue
=
Value
;
SanitizeValueForCSV
(
SanitizedValue
);
DependentVariable
->
Value
=
SanitizedValue
;
return
true
;
}
...
...
@@ -149,10 +150,15 @@ bool USFCondition::StoreMultipleTrialDependentVariableData(const FString& VarNam
return
false
;
}
USFGameInstance
::
Get
()
->
GetParticipant
()
->
StoreTrialInPhaseLongTable
(
TrialDependentVar
,
Values
);
TArray
<
FString
>
SanitizedValues
=
Values
;
for
(
FString
&
Value
:
SanitizedValues
)
{
SanitizeValueForCSV
(
Value
);
}
USFGameInstance
::
Get
()
->
GetParticipant
()
->
StoreTrialInPhaseLongTable
(
TrialDependentVar
,
SanitizedValues
);
std
::
vector
<
FString
>
ValuesVector
;
for
(
const
FString
&
Value
:
Values
)
for
(
const
FString
&
Value
:
Sanitized
Values
)
{
ValuesVector
.
push_back
(
Value
);
}
...
...
@@ -193,6 +199,17 @@ USFDependentVariable* USFCondition::GetDependentVarForDataStoring(const FString&
return
nullptr
;
}
bool
USFCondition
::
SanitizeValueForCSV
(
FString
&
Value
)
{
if
(
Value
.
Contains
(
","
))
{
FSFLoggingUtils
::
Log
(
"Cannot log data containing a ',' into a csv file, replacing ',' with [Komma]"
,
true
);
Value
.
ReplaceInline
(
TEXT
(
","
),
TEXT
(
"[Komma]"
));
return
false
;
}
return
true
;
}
float
USFCondition
::
GetTimeTaken
()
const
{
return
TimeTaken
;
...
...
This diff is collapsed.
Click to expand it.
Source/StudyFrameworkPlugin/Public/SFCondition.h
+
2
−
0
View file @
e92f2007
...
...
@@ -78,6 +78,8 @@ protected:
USFDependentVariable
*
GetDependentVarForDataStoring
(
const
FString
&
VarName
,
const
FString
&
Data
);
bool
SanitizeValueForCSV
(
FString
&
Value
);
private:
bool
bStarted
=
false
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment