def message(): h = HaysHours() h.set_db(p) lastHourSaved = h.getLastSaved() if len(lastHourSaved) > 0: return render_template("form.html", lastHourSaved=lastHourSaved, stateful_type=stateful_type) else: return render_template("form.html", stateful_type=stateful_type)
def testSaveOneDate_andLastEmpty(self): """Should return the pre-last non-empty""" h = HaysHours() h.set_db(self.p) endHour = h.getEnd("6.3") h.getEnd("") lastHourSaved = h.getLastSaved() self.assertEqual(endHour, lastHourSaved)
def testSaveOneDate_andLastEmpty(self): '''Should return the pre-last non-empty''' h = HaysHours() h.set_db(self.p) endHour = h.getEnd('6.3') h.getEnd('') lastHourSaved = h.getLastSaved() self.assertEqual(endHour, lastHourSaved)
def calc(): if request.method == "POST": req = request.form h = HaysHours() h.set_db(p) lastHourSaved = h.getLastSaved() elapsed = req.get("elapsed") endHour = h.getEnd(elapsed) if len(elapsed) == 0: err_msg = "No end-time because no elapsed time given." return render_template("form.html", err_msg=err_msg, stateful_type=stateful_type) if lastHourSaved: return render_template( "form.html", endHour=endHour, elapsed=elapsed, lastHourSaved=lastHourSaved, stateful_type=stateful_type, ) else: return render_template( "form.html", endHour=endHour, elapsed=elapsed, stateful_type=stateful_type, ) else: lastHourSaved = p.readLast() if lastHourSaved: return render_template("form.html", lastHourSaved=lastHourSaved, stateful_type=stateful_type) else: return render_template("form.html", stateful_type=stateful_type)
def testEmptySring(self): h = HaysHours() endHour = h.getEnd('') self.assertEqual(endHour, '')
def testGetEndHour6_3(self): h = HaysHours() endHour = h.getEnd('6.3') self.assertEqual(endHour, "14:03:00")
def testGetEndHour8(self): h = HaysHours() endHour = h.getEnd('8') self.assertEqual(endHour, "16:00:00")
def testGetEndHour10_5(self): h = HaysHours() endHour = h.getEnd('10.5') self.assertEqual(endHour, "19:00:00")
def testGetEndHour9_2(self): h = HaysHours() endHour = h.getEnd('9.2') self.assertEqual(endHour, "17:42:00")
def testGetEndHour7_2(self): h = HaysHours() endHour = h.getEnd('7.2') self.assertEqual(endHour, "15:12:00")
def testGetEndHour8_6(self): h = HaysHours() endHour = h.getEnd('8.6') self.assertEqual(endHour, "17:06:00")
def testGetEndHour8_4(self): h = HaysHours() endHour = h.getEnd('8.4') self.assertEqual(endHour, "16:24:00")
def end_hour(elapsed): h = HaysHours() h.set_db(p) endHour = h.getEnd(elapsed) return endHour
def testNoSavedData(self): h = HaysHours() h.set_db(self.p) h.getEnd("") lastHourSaved = h.getLastSaved() self.assertEqual("", lastHourSaved)
def testGetEndHour6_3(self): h = HaysHours() h.set_db(self.p) endHour = h.getEnd("6.3") lastHourSaved = h.getLastSaved() self.assertEqual(lastHourSaved, endHour)