summaryrefslogtreecommitdiff
path: root/lorrycontroller/htmlstatus.py
diff options
context:
space:
mode:
Diffstat (limited to 'lorrycontroller/htmlstatus.py')
-rw-r--r--lorrycontroller/htmlstatus.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/lorrycontroller/htmlstatus.py b/lorrycontroller/htmlstatus.py
index aae75c7..50b69ee 100644
--- a/lorrycontroller/htmlstatus.py
+++ b/lorrycontroller/htmlstatus.py
@@ -25,10 +25,12 @@ class HTMLStatusManager(object):
self.series = None
self.filename = self.app.settings['html-file']
self.mgr = None
+ self.all_processing = set()
self.processing = None
- self.processing_time = None
+ self.processing_time = time.time()
self.failing = None
self.all_lorries_ever = set()
+ self.bump_time = time.time()
def set_failing(self, failmsg):
self.failing = failmsg
@@ -38,12 +40,15 @@ class HTMLStatusManager(object):
self.mgr = mgr
def set_processing(self, proc):
+ if self.processing is not None:
+ self.all_processing.add(self.processing)
self.processing = proc
self.processing_time = time.time()
self.write_out_status()
def bump_state(self):
self.state = self.state + 1
+ self.bump_time = time.time()
self.processing = None
self.write_out_status()
@@ -137,7 +142,10 @@ function reloadAfter(timeout) {
state = "Processing since " + \
time.asctime(time.gmtime(self.processing_time))
elif troveinfo.get('next-vls', now - 1) < now:
- state = "Due to be checked"
+ if self.state < len(state_names) - 1:
+ state = "Due to be checked this run."
+ else:
+ state = "Due to be checked on the next run"
state = self.tag("td", content=escape(state))
nextdue = self.tag("td", content=escape(time.asctime(
time.gmtime(troveinfo.get('next-vls', now - 1)))))
@@ -186,16 +194,20 @@ function reloadAfter(timeout) {
lorryinfo = self.mgr.lorry_state.get(lorry_name, {})
uuid = self.tag("td", content=
escape(lorry.get('controller-uuid', 'Dead')))
- state = "Waiting until " + \
- time.asctime(time.gmtime(lorryinfo.get('next-due', now - 1)))
+ state = "Waiting "
if self.processing == lorry_name:
state = "Processing since " + \
time.asctime(time.gmtime(self.processing_time))
- elif lorryinfo.get('next-due', now - 1) < now:
- state = "Due to be checked"
+ elif lorryinfo.get('next-due', now - 1) < self.bump_time:
+ if self.state < len(state_names) - 1:
+ state = "Due to be checked this run."
+ else:
+ state = "Due to be checked on the next run"
if self.mgr is not None:
if self.mgr.lorry_state.get(lorry_name, None) is None:
state = "Needs creating"
+ elif lorry_name in self.all_processing:
+ state = "Processed"
if dead_lorry:
state = "Dead - To be removed"
if dead_and_gone: