Track counts for all hugveys (not only selected) and show duration of playing
This commit is contained in:
parent
c7f39cab6d
commit
7aad114b13
4 changed files with 16 additions and 1 deletions
|
@ -128,7 +128,9 @@ class CentralCommand(object):
|
||||||
status['finished'] = hv.story.isFinished()
|
status['finished'] = hv.story.isFinished()
|
||||||
status['history'] = {} if isSelected is False else hv.story.getLogSummary()
|
status['history'] = {} if isSelected is False else hv.story.getLogSummary()
|
||||||
# status['history'] = hv.story.getLogSummary() # disabled as it is a bit slow. We now have eventLog
|
# status['history'] = hv.story.getLogSummary() # disabled as it is a bit slow. We now have eventLog
|
||||||
status['counts'] = {t: len(a) for t, a in status['history'].items() if t != 'directions' }
|
# status['counts'] = {t: len(a) for t, a in status['history'].items() if t != 'directions' }
|
||||||
|
status['counts'] = hv.story.getLogCounts()
|
||||||
|
status['duration'] = hv.story.timer.getElapsed()
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
|
|
@ -482,6 +482,7 @@ class Diversion(object):
|
||||||
r = await self.method(story, msgFrom, msgTo)
|
r = await self.method(story, msgFrom, msgTo)
|
||||||
if r:
|
if r:
|
||||||
self.hasHit = True
|
self.hasHit = True
|
||||||
|
story.addToLog(self)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
async def finalise(self, story):
|
async def finalise(self, story):
|
||||||
|
@ -763,6 +764,12 @@ class Story(object):
|
||||||
# print(self.log)
|
# print(self.log)
|
||||||
return summary
|
return summary
|
||||||
|
|
||||||
|
def getLogCounts(self):
|
||||||
|
return {
|
||||||
|
'messages': len([1 for e in self.log if isinstance(e[0], Message)]),
|
||||||
|
'diversions': len([1 for e in self.log if isinstance(e[0], Diversion)]),
|
||||||
|
}
|
||||||
|
|
||||||
def registerVariable(self, variableName, message):
|
def registerVariable(self, variableName, message):
|
||||||
if variableName not in self.variables:
|
if variableName not in self.variables:
|
||||||
self.variables[variableName] = [message]
|
self.variables[variableName] = [message]
|
||||||
|
|
2
www/images/icon-clock.svg
Normal file
2
www/images/icon-clock.svg
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1024 544v448q0 14-9 23t-23 9h-320q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h224v-352q0-14 9-23t23-9h64q14 0 23 9t9 23zm416 352q0-148-73-273t-198-198-273-73-273 73-198 198-73 273 73 273 198 198 273 73 273-73 198-198 73-273zm224 0q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/></svg>
|
After Width: | Height: | Size: 507 B |
|
@ -59,6 +59,10 @@
|
||||||
<img class='icon' src="/images/icon-position.svg" title="position">
|
<img class='icon' src="/images/icon-position.svg" title="position">
|
||||||
{{ hv.msg }}
|
{{ hv.msg }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class='timer'>
|
||||||
|
<img class='icon' src="/images/icon-clock.svg" title="timer">
|
||||||
|
{{ timer(hv, 'duration') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='btn' v-if="hv.status == 'running'" @click.stop="pause(hv)">Pause</div>
|
<div class='btn' v-if="hv.status == 'running'" @click.stop="pause(hv)">Pause</div>
|
||||||
<div class='btn' v-if="hv.status == 'paused'" @click.stop="resume(hv)">Resume</div>
|
<div class='btn' v-if="hv.status == 'paused'" @click.stop="resume(hv)">Resume</div>
|
||||||
|
|
Loading…
Reference in a new issue