parent
446d6afc71
commit
25829377a1
|
@ -57,12 +57,17 @@ def activity_results(form):
|
|||
print(query)
|
||||
sessions = SessionResult.objects.raw(query)
|
||||
activity = {}
|
||||
last_session = {}
|
||||
for session in sessions:
|
||||
time = -safe_int(session.unix) if session.action == 1 else safe_int(session.unix)
|
||||
if session.player in activity:
|
||||
if last_session[session.player] == session.action:
|
||||
continue
|
||||
activity[session.player] += time
|
||||
last_session[session.player] = session.action
|
||||
else:
|
||||
activity[session.player] = time
|
||||
last_session[session.player] = session.action
|
||||
results = []
|
||||
for player, time in activity.items():
|
||||
results.append(ActivityResult(player, time))
|
||||
|
|
Loading…
Reference in New Issue