Change from assertion to printing for renew
- fixes renew after already marked. successful service would be deleted. Therefore renew fails
This commit is contained in:
parent
0722174ca6
commit
b29d97d28a
|
@ -53,7 +53,7 @@ class Database:
|
|||
def updateScheduleEntry(self,day, username, cid, time):
|
||||
c = self.conn.cursor()
|
||||
res = c.execute('''
|
||||
UPDATE schedule SET time=%s
|
||||
UPDATE schedule SET time=%s, status=-1, tries=0
|
||||
WHERE day=%s AND username=%s AND cid=%s
|
||||
''',
|
||||
(time, day, username, cid))
|
||||
|
|
|
@ -5,7 +5,8 @@ from pathlib import Path
|
|||
|
||||
from config import BASEPATH
|
||||
|
||||
runner = str(Path(BASEPATH, "child.py"))
|
||||
#runner = str(Path(BASEPATH, "child.py"))
|
||||
runner = str(Path(BASEPATH, "markattendance.py"))
|
||||
|
||||
|
||||
def Schedule(time, user, cid, day, capture_output=True):
|
||||
|
|
|
@ -58,18 +58,22 @@ class Attendance:
|
|||
print("New schedule detected")
|
||||
try:
|
||||
sch = scheduler.cancelSchedule(self.username, cid, capture_output=False)
|
||||
assert sch.returncode == 0, "Schedule cancel failed"
|
||||
if sch.returncode != 0:
|
||||
print("CancelSchedule Failed stdout: {} stderr: {}".format(sch.stdout, sch.stderr))
|
||||
sch = scheduler.Schedule(str(time), self.username, cid, daystamp, capture_output=False)
|
||||
assert sch.returncode == 0, "Schedule renew failed"
|
||||
if sch.returncode != 0:
|
||||
print("SetNewSchedule Failed stdout: {} stderr: {}".format(sch.stdout, sch.stderr))
|
||||
db.updateScheduleEntry(daystamp, self.username, cid, time)
|
||||
except:
|
||||
print("Error: Schedule cancel/renew failed")
|
||||
except Exception as e:
|
||||
print("Renew failed:", e)
|
||||
else:
|
||||
print("Same schedule detected. continue")
|
||||
continue
|
||||
else:
|
||||
sch = scheduler.Schedule(str(time), self.username, cid, daystamp, capture_output=False)
|
||||
assert sch.returncode == 0, "Create schedule failed"
|
||||
if sch.returncode != 0:
|
||||
print("CancelSchedule Failed stdout: {} stderr: {}".format(sch.stdout, sch.stderr))
|
||||
exit(1)
|
||||
db.createScheduleEntry(daystamp, self.username, cid, time, subj)
|
||||
|
||||
def login_session(username, password, sess):
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<div class="steps">
|
||||
<ol type="1">
|
||||
<li>Send a <code>\start</code> message to the telegram bot <a href="https://t.me/proxybro_bot" target="_blank" rel="noopener">@proxybro_bot</a></li>
|
||||
<li>Send a <code>/start</code> message to the telegram bot <a href="https://t.me/proxybro_bot" target="_blank" rel="noopener">@proxybro_bot</a></li>
|
||||
<li>The bot will send back a verification link.</li>
|
||||
<li>Click on the link and login.</li>
|
||||
</ol>
|
||||
|
|
Loading…
Reference in New Issue