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 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 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 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)