new session verdicts and colors
This commit is contained in:
@@ -219,14 +219,24 @@ def get_session_metrics(ps):
|
||||
|
||||
return thedict
|
||||
|
||||
cratiocolors = {
|
||||
'started': "lightgreen",
|
||||
'almost complete': "mediumgreen",
|
||||
'completed': "green",
|
||||
'a bit too much': "purple",
|
||||
'way too much': "violet",
|
||||
'missed': "black",
|
||||
'not done': "white",
|
||||
}
|
||||
|
||||
def is_session_complete_ws(ws,ps):
|
||||
ws = ws.order_by("date")
|
||||
if len(ws)==0:
|
||||
today = date.today()
|
||||
if today > ps.enddate:
|
||||
status = 'missed'
|
||||
verdict = 'missed'
|
||||
ratio = 0
|
||||
return ratio,status,None
|
||||
return ratio,verdict,None
|
||||
else:
|
||||
return 0,'not done',None
|
||||
|
||||
@@ -238,11 +248,23 @@ def is_session_complete_ws(ws,ps):
|
||||
|
||||
cratiomin = 1
|
||||
cratiomax = 1
|
||||
|
||||
cratios = {
|
||||
'started':0,
|
||||
'almost complete':0.6,
|
||||
'completed':0.8,
|
||||
'a bit too much':1.2,
|
||||
'way too much': 1.5
|
||||
}
|
||||
|
||||
|
||||
if ps.criterium == 'none':
|
||||
if ps.sessiontype == 'session':
|
||||
cratiomin = 0.8
|
||||
cratiomax = 1.2
|
||||
else:
|
||||
cratios['completed'] = 0.9167
|
||||
cratios['a bit too much'] = 1.0833
|
||||
cratiomin = 0.9167
|
||||
cratiomax = 1.0833
|
||||
|
||||
@@ -271,7 +293,7 @@ def is_session_complete_ws(ws,ps):
|
||||
|
||||
ratio = score/float(value)
|
||||
|
||||
status = 'partial'
|
||||
verdict = 'started'
|
||||
|
||||
if ps.sessiontype in ['session','cycletarget']:
|
||||
if ps.criterium == 'exact':
|
||||
@@ -290,11 +312,12 @@ def is_session_complete_ws(ws,ps):
|
||||
|
||||
return ratio,'partial',completiondate
|
||||
else:
|
||||
if ratio>cratiomin and ratio<cratiomax:
|
||||
return ratio,'completed',completiondate
|
||||
else:
|
||||
completiondate = ws.reverse()[0].date
|
||||
return ratio,'partial',completiondate
|
||||
for key,value in cratios.iteritems():
|
||||
if ratio>value:
|
||||
verdict = key
|
||||
|
||||
completiondate = ws.reverse()[0].date
|
||||
return ratio,verdict,completiondate
|
||||
elif ps.sessiontype == 'test':
|
||||
if ratio==1.0:
|
||||
return ratio,'completed',completiondate
|
||||
@@ -361,11 +384,11 @@ def is_session_complete_ws(ws,ps):
|
||||
else:
|
||||
if not completiondate:
|
||||
completiondate = ws.reverse()[0].date
|
||||
return ratio,status,completiondate
|
||||
return ratio,verdict,completiondate
|
||||
|
||||
|
||||
def is_session_complete(r,ps):
|
||||
status = 'not done'
|
||||
verdict = 'not done'
|
||||
|
||||
|
||||
if r not in ps.rower.all():
|
||||
|
||||
Reference in New Issue
Block a user