Esempio n. 1
0
 def deleteAllPressurePointsById(self, measurementid):
     dao = PressurePointDAO()
     if not dao.getPressurePointsById(measurementid):
         return jsonify(Error="Pressure points not found."), 404
     else:
         dao.deletePressurePointsById(measurementid)
         return jsonify(DeleteStatus="OK"), 200
Esempio n. 2
0
 def getPressurePointById(self, pressurepointid):
     dao = PressurePointDAO()
     result = dao.getPressurePointById(pressurepointid)
     if result is None:
         return jsonify(Error="Pressure point doesn't exist!")
     else:
         result_map = self.build_pressurepoint_dict(result)
     return jsonify(Users=result_map)
Esempio n. 3
0
 def getAllPressurePoints(self):
     dao = PressurePointDAO()
     pressurepoints_list = dao.getAllPressurePoints()
     result_map = []
     for row in pressurepoints_list:
         result = self.build_pressurepoint_dict(row)
         result_map.append(result)
     return jsonify(PressurePoints=result_map)
Esempio n. 4
0
 def getPressurePointsById(self, measurementid):
     dao = PressurePointDAO()
     result = dao.getPressurePointsById(measurementid)
     if result is None:
         return jsonify(Error="Pressure point doesn't exist!")
     else:
         result_map = []
         for row in result:
             result = self.build_pressurepoint_dict(row)
             result_map.append(result)
         return jsonify(PressurePoints=result_map)
Esempio n. 5
0
 def storePressurePointById(self, measurementid, form):
     dao = PressurePointDAO()
     if len(form) != 2:
         return jsonify(Error="Malformed post request"), 400
     else:
         mid = measurementid
         ppoint = form['ppoint']
         sensor_num = form['sensor_num']
         if ppoint and sensor_num:
             pid = dao.storePressurePointById(mid, ppoint, sensor_num)
             result = self.build_pressurepoint_attributes(
                 pid, ppoint, sensor_num, mid)
             return jsonify(PressurePoint=result), 200
         else:
             return jsonify(
                 Error="Unexpected attributes in post request"), 400
Esempio n. 6
0
 def deleteAllPressurePoints(self):
     dao = PressurePointDAO()
     if not dao.getAllPressurePoints():
         return jsonify(Error="No pressure points found."), 404
     else:
         if dao.getAllPressurePoints():
             dao.deleteAllPressurePoints()
         return jsonify(DeleteStatus="OK"), 200