func GetFeedbackByStudent(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	reservationId := r.PostFormValue("reservation_id")
	studentId := r.PostFormValue("student_id")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var sl = buslogic.StudentLogic{}

	var feedbackJson = make(map[string]interface{})
	reservation, err := sl.GetFeedbackByStudent(reservationId, studentId)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}
	if len(reservation.StudentFeedback.Name) == 0 {
		feedbackJson["name"] = reservation.StudentInfo.Name
	} else {
		feedbackJson["name"] = reservation.StudentFeedback.Name
	}
	if len(reservation.StudentFeedback.Problem) == 0 {
		feedbackJson["problem"] = reservation.StudentInfo.Problem
	} else {
		feedbackJson["problem"] = reservation.StudentFeedback.Problem
	}
	feedbackJson["choices"] = reservation.StudentFeedback.Choices
	feedbackJson["score"] = reservation.StudentFeedback.Score
	feedbackJson["feedback"] = reservation.StudentFeedback.Feedback
	result["feedback"] = feedbackJson

	return result
}
func MakeReservationByStudent(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	reservationId := r.PostFormValue("reservation_id")
	name := r.PostFormValue("name")
	gender := r.PostFormValue("gender")
	studentId := r.PostFormValue("student_id")
	school := r.PostFormValue("school")
	hometown := r.PostFormValue("hometown")
	mobile := r.PostFormValue("mobile")
	email := r.PostFormValue("email")
	experience := r.PostFormValue("experience")
	problem := r.PostFormValue("problem")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var sl = buslogic.StudentLogic{}

	var reservationJson = make(map[string]interface{})
	reservation, err := sl.MakeReservationByStudent(reservationId, name, gender, studentId, school, hometown,
		mobile, email, experience, problem)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}
	reservationJson["start_time"] = reservation.StartTime.In(utils.Location).Format(utils.TIME_PATTERN)
	reservationJson["end_time"] = reservation.EndTime.In(utils.Location).Format(utils.TIME_PATTERN)
	reservationJson["teacher_fullname"] = reservation.TeacherFullname
	result["reservation"] = reservationJson

	return result
}
func SubmitFeedbackByStudent(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	reservationId := r.PostFormValue("reservation_id")
	name := r.PostFormValue("name")
	problem := r.PostFormValue("problem")
	choices := r.PostFormValue("choices")
	score := r.PostFormValue("score")
	feedback := r.PostFormValue("feedback")
	studentId := r.PostFormValue("student_id")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var sl = buslogic.StudentLogic{}

	_, err := sl.SubmitFeedbackByStudent(reservationId, name, problem, choices, score, feedback, studentId)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}

	return result
}
func GetTeacherInfoByStudent(w http.ResponseWriter, r *http.Request, userId string, userType models.UserType) interface{} {
	reservationId := r.PostFormValue("reservation_id")

	var result = map[string]interface{}{"state": "SUCCESS"}
	var sl = buslogic.StudentLogic{}

	var teacherJson = make(map[string]interface{})
	teacher, err := sl.GetTeacherInfoByStudent(reservationId)
	if err != nil {
		ErrorHandler(w, r, err)
		return nil
	}
	teacherJson["teacher_username"] = teacher.Username
	teacherJson["fullname"] = teacher.Fullname
	teacherJson["gender"] = teacher.Gender
	teacherJson["major"] = teacher.Major
	teacherJson["academic"] = teacher.Academic
	teacherJson["aptitude"] = teacher.Aptitude
	teacherJson["problem"] = teacher.Problem
	result["teacher"] = teacherJson

	return result
}