addSurvay method

Future<int> addSurvay(
  1. int sessionID,
  2. int studentID,
  3. Map<String, String> results,
  4. int time
)

Implementation

Future<int> addSurvay(
  int sessionID,
  int studentID,
  Map<String, String> results,
  int time,
) async {
  if (sessionID == -1 || studentID == -1) {
    return -1;
  }
  final Either<String, Map<String, dynamic>> res =
      await mappingPostRequest("/surveys", <String, dynamic>{
    "studentID": studentID,
    "sessionID": sessionID,
    "time": time,
    ...results,
  }).run();

  return res.getOrElse((String l) => <String, dynamic>{})["id"];
}