Show the number of starts since the change of language
This commit is contained in:
parent
fe0b67aed4
commit
df80b6063e
4 changed files with 19 additions and 0 deletions
|
@ -241,6 +241,7 @@ class CentralCommand(object):
|
|||
'hugveys': [],
|
||||
'logbookId': None,
|
||||
'logbook': [],
|
||||
'starts_since_lang_change': self.getHugveyStartsSinceLanguageChange()
|
||||
}
|
||||
|
||||
#use this to test if any threads stay open
|
||||
|
@ -258,6 +259,19 @@ class CentralCommand(object):
|
|||
|
||||
return status
|
||||
|
||||
def getHugveyStartsSinceLanguageChange(self):
|
||||
'''
|
||||
Some info on the nr. of hugveys since last change of language (using the change-all button in panopticon)
|
||||
'''
|
||||
changeTime = self.timer.marks['languageChange'] if self.timer.hasMark('languageChange') else self.timer.marks['start']
|
||||
nrOfStarts = 0
|
||||
for hv in self.hugveys.values():
|
||||
if hv.story:
|
||||
if hv.story.timer.hasMark('first_speech'):
|
||||
if hv.story.timer.marks['first_speech'] > changeTime:
|
||||
nrOfStarts += 1
|
||||
return nrOfStarts
|
||||
|
||||
def setLoopTime(self, secondsAgo: int):
|
||||
self.timer.setMark('start', time.time() - secondsAgo)
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ def getWebSocketHandler(central_command):
|
|||
"""
|
||||
Set language for all future hugvey runs (so after a 'finish')
|
||||
"""
|
||||
central_command.timer.setMark('languageChange')
|
||||
for hv_id in central_command.hugveys:
|
||||
if central_command.hugveys[hv_id].eventQueue:
|
||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language_if_available', 'lang_code': lang_code})
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
<input type="button" onclick="panopticon.change_loop_time(document.getElementById('loop_time_value').value)" value="set time">
|
||||
</div>
|
||||
|
||||
<span title="Conversations started since last language change">{{starts_since_lang_change}}</span>
|
||||
|
||||
|
||||
<ul id='languages'>
|
||||
<li v-for="lang in languages" :title="lang.file"
|
||||
|
|
|
@ -19,6 +19,7 @@ class Panopticon {
|
|||
selectedLang: null,
|
||||
blockedHugveys: 0,
|
||||
availableHugveys: 0,
|
||||
starts_since_lang_change: 0,
|
||||
},
|
||||
methods: {
|
||||
time_passed: function( hugvey, property ) {
|
||||
|
@ -183,6 +184,7 @@ class Panopticon {
|
|||
this.hugveys.hugveys = msg['hugveys'];
|
||||
this.hugveys.logbook = msg['logbook'];
|
||||
this.hugveys.logbookId = msg['logbookId'];
|
||||
this.hugveys.starts_since_lang_change = msg['starts_since_lang_change'];
|
||||
if(this.hugveys.selectedId) {
|
||||
this.updateSelectedHugvey();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue