Skip to content

Commit e969dd0

Browse files
committed
ppid randomises for new participant
1 parent 7f3e08b commit e969dd0

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

Assets/ExpMngr/Scripts/Form/FillableFormController.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public void Generate(List<FormElementEntry> formElements)
6262
throw new System.Exception("Duplicated internal names. They must be unique.");
6363
}
6464
}
65+
66+
// set ppid field to current time
67+
TextFormController ppidText = (TextFormController)ppidElement.controller;
68+
ppidText.SetToTimeNow();
69+
6570
}
6671

6772

@@ -122,6 +127,7 @@ public class FormElementEntry
122127

123128
public FormElementController controller { get; set; }
124129

130+
125131
public void Initialise(FormElementController formElementController)
126132
{
127133
controller = formElementController;

Assets/ExpMngr/Scripts/Form/FormElementController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class FormElementController : MonoBehaviour
1414
public FormDataType dataType;
1515
protected string originalTitle;
1616

17-
1817
public float height { get { return rectTransform.rect.height; } }
1918

2019
[HideInInspector]

Assets/ExpMngr/Scripts/Form/TextFormController.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using UnityEngine;
44
using UnityEngine.UI;
5+
using System;
56

67
namespace ExpMngr
78
{
@@ -37,6 +38,13 @@ public override void Clear()
3738
inputField.text = "";
3839
}
3940

41+
42+
public void SetToTimeNow()
43+
{
44+
DateTime dt = DateTime.Now;
45+
inputField.text = dt.ToString("P_yyMMddHHmmss");
46+
}
47+
4048
protected override void Setup()
4149
{
4250

Assets/ExpMngr/Scripts/ParticipantListSelection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void SetPPList(DataTable data)
115115

116116
List<string> participants = ppList.AsEnumerable().Select(x => x[0].ToString()).ToList();
117117
participantSelector.SetParticipants(participants);
118-
participantSelector.SelectNew();
118+
participantSelector.SelectNewList();
119119

120120
// enable selector
121121
ExperimentStartupController.SetSelectableAndChildrenInteractable(participantSelector.gameObject, true);

Assets/ExpMngr/Scripts/ParticipantSelector.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void SetParticipants(List<string> participants)
2727
participantDropdown.SetItems(ppList);
2828
}
2929

30-
public void SelectNew()
30+
public void SelectNewList()
3131
{
3232
participantDropdown.Clear();
3333
}
@@ -38,6 +38,8 @@ public void SelectItem(int value)
3838
if (value == 0) // "new participant"
3939
{
4040
form.Clear();
41+
TextFormController ppidText = (TextFormController) form.ppidElement.controller;
42+
ppidText.SetToTimeNow();
4143
}
4244
else
4345
{

0 commit comments

Comments
 (0)