Commit d39eb567 authored by root's avatar root

Adjust account sorting algorithm

parent f67303da
...@@ -42,7 +42,12 @@ guest_sessions = [] ...@@ -42,7 +42,12 @@ guest_sessions = []
test_index = 0 test_index = 0
def next_session(): def next_session():
sessions = sorted([s for s in account_sessions if not s.locked], key=lambda s:-s.remaining) def key(s):
remaining_time = s.reset - time.time()
if s.remaining <= 3 and remaining_time > 0:
return 900
return remaining_time
sessions = sorted([s for s in account_sessions if not s.locked], key=key)
if len(sessions) > 0: if len(sessions) > 0:
return sessions[0] return sessions[0]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment