diff --git a/lib/Maze.dart b/lib/Maze.dart index ac35f23..008f905 100644 --- a/lib/Maze.dart +++ b/lib/Maze.dart @@ -9,6 +9,7 @@ import 'package:uuid/uuid.dart'; import 'userIDD.dart'; var uuid = Uuid(); +DateTime startTime = DateTime.now(); class gameButton extends StatefulWidget { int id; @@ -159,9 +160,11 @@ class gameButtonState extends State { }); //ending condition- if move is correct AND the last square on the path then game should display message congratulating them if(widget.id==99) { - var dict = {"path":path, "moves": moves, "errors": errors, "times": times}; + var dict = {"path":path, "moves": moves, "errors": errors, "times": times, + "subjectID": subjectId, "startTime": startTime.toString(), + "trial": attemptNum.toString() }; String data = json.encode(dict); - createData("GMLT-10x10", uuid.v1().toString(), data, id + "-" + attemptNum.toString()); + createData("GMLT-10x10", uuid.v1().toString(), data, "1.0.0"); attemptNum++; showDialog( context: context, diff --git a/lib/MazeTest.dart b/lib/MazeTest.dart index ed9a165..f337422 100644 --- a/lib/MazeTest.dart +++ b/lib/MazeTest.dart @@ -14,6 +14,7 @@ var uuid = Uuid(); //initialize new maze maze maze2= new maze(); +DateTime startTime = DateTime.now(); Color color1 = Colors.grey; int lastMove = 0; //records last CORRECT move of user bool lastMoveIncorrect = true; //true if user's last move was correct, false otherwise @@ -194,9 +195,11 @@ class gameButtonState extends State { }); //ending condition- if move is correct AND the last square on the path then game should display message congratulating them if(widget.id==35) { - var dict2 = {"path":path2, "moves": moves2, "errors": errors2, "times": times2}; + var dict2 = {"path":path2, "moves": moves2, "errors": errors2, "times": times2, + "subjectId": subjectId, "startTime": startTime.toIso8601String(), + "trial": attemptNum.toString() }; String data = json.encode(dict2); - createData("GMLT-5x5", uuid.v1().toString(), data, id); + createData("GMLT-6x6", uuid.v1().toString(), data, "1.0.0"); showDialog( context: context, diff --git a/lib/userIDD.dart b/lib/userIDD.dart index 656dd38..25522d6 100644 --- a/lib/userIDD.dart +++ b/lib/userIDD.dart @@ -3,14 +3,14 @@ import 'package:uuid/uuid.dart'; import 'startingScreen.dart'; //import 'package:shared_preferences/shared_preferences.dart'; -String id; +String subjectId; + class SubjectIDPage extends StatefulWidget { @override SubjectIDPageState createState() => SubjectIDPageState(); } class SubjectIDPageState extends State { - String subjectId; showAlertDialog(BuildContext context) { // set up the button @@ -60,7 +60,6 @@ class SubjectIDPageState extends State { hintText: 'Enter Subject ID'), onChanged: (value) { subjectId = value; - id=value; }, ), height: MediaQuery.of(context).size.width * 0.25,