diff --git a/call.cgi b/call.cgi index c5c6f95..002a848 100755 --- a/call.cgi +++ b/call.cgi @@ -76,8 +76,8 @@ reject = False for date, action in db[machine]: if action.startswith("on:"): - if fr - date > timedelta(hours=10): - continue + if candidate != [] and candidate[-1][2] == "---": + candidate.pop() action, id_ = action.split(":") id_ = id_.lower() if date < to: @@ -107,6 +107,8 @@ if id_.lower() == candidate[-1][4]: reject = True candidate.pop() + elif action.startswith("startup") and candidate: + action = "off:" + candidate[-1][4] elif action.startswith("shutdown") and candidate: action = "off:" + candidate[-1][4] if action.startswith("off:"): @@ -119,8 +121,11 @@ elif active and id_ == candidate[-1][4]: active = False candidate[-1][2] = date.strftime(datefmt) - candidate[-1][1] += "〜"+date.strftime(datefmt) - elif fr < date and fr + timedelta(hours=2) > date: # no candidate + if candidate[-1][1].startswith("?"): + candidate[-1][1] = "?〜"+date.strftime(datefmt) + else: + candidate[-1][1] += "〜" + date.strftime(datefmt) + elif fr < date and to > date: # no candidate to_entry = date.strftime(datefmt) entry = date.strftime(datefmt) res = c.execute(query, (id_,)) @@ -128,7 +133,7 @@ if dd: candidate.append( # 0 1 2 3 4 - [machine, entry, to_entry, action, id_, + [machine, "?〜" + entry, to_entry, action, id_, # 5 6 dd[0], dd[1], # 7 8 @@ -136,7 +141,7 @@ else: candidate.append( # 0 1 2 3 4 - [machine, entry, "---", action, id_, + [machine, "?〜"+entry, "---", action, id_, # 5 6 "????", id_, # 7 8