Apply prettier

This commit is contained in:
Kenshin Abe
2023-03-20 15:27:31 +09:00
parent 79bf067747
commit 261a13dea7
3 changed files with 11 additions and 6 deletions
+6 -3
View File
@@ -155,13 +155,16 @@ export const actionCreator = () => {
const setTrialUserAttrs = (
studyId: number,
index: number,
user_attrs: { [key: string]: number },
user_attrs: { [key: string]: number }
) => {
const newTrial: Trial = Object.assign(
{},
studyDetails[studyId].trials[index]
)
newTrial.user_attrs = Object.keys(user_attrs).map(key => ({ key: key, value: user_attrs[key].toString() }))
newTrial.user_attrs = Object.keys(user_attrs).map((key) => ({
key: key,
value: user_attrs[key].toString(),
}))
const newTrials: Trial[] = [...studyDetails[studyId].trials]
newTrials[index] = newTrial
const newStudy: StudyDetail = Object.assign({}, studyDetails[studyId])
@@ -529,7 +532,7 @@ export const actionCreator = () => {
const saveTrialUserAttrs = (
studyId: number,
trialId: number,
user_attrs: { [key: string]: number },
user_attrs: { [key: string]: number }
): void => {
console.log("user_attrs", user_attrs)
const message = `id=${trialId}, user_attrs=${JSON.stringify(user_attrs)}`
@@ -26,7 +26,7 @@ export const ObjectiveForm: FC<{
const theme = useTheme()
const action = actionCreator()
const [values, setValues] = useState<(number | null)[]>(
widgets.map(widget => {
widgets.map((widget) => {
if (widget === undefined) {
return null
} else if (widget.type === "text") {
@@ -72,7 +72,9 @@ export const ObjectiveForm: FC<{
}
action.makeTrialComplete(trial.study_id, trial.trial_id, filtered)
} else if (outputType == "user_attr") {
const user_attrs = Object.fromEntries(widgets.map((widget, i) => [widget.user_attr_key, values[i]]))
const user_attrs = Object.fromEntries(
widgets.map((widget, i) => [widget.user_attr_key, values[i]])
)
action.saveTrialUserAttrs(trial.study_id, trial.trial_id, user_attrs)
}
}
+1 -1
View File
@@ -151,7 +151,7 @@ const TrialListDetail: FC<{
directions,
objectiveNames,
objectiveFormWidgets,
formWigetsOutputType
formWigetsOutputType,
}) => {
const theme = useTheme()
const artifactEnabled = useRecoilValue<boolean>(artifactIsAvailable)