diff --git a/moderator.py b/moderator.py index bc32ab0..a5f1cf8 100644 --- a/moderator.py +++ b/moderator.py @@ -78,7 +78,7 @@ def getmessage(moderatorid): if gottuple == None: return False - cur.execute("UPDATE berichten SET statusid = 2, moderatorid = (%s) WHERE berichtid = (%s)", (gottuple[0], moderatorid)) + cur.execute("UPDATE berichten SET statusid = 2, moderatorid = (%s) WHERE berichtid = (%s)", (moderatorid, gottuple[0])) conn.commit() return gottuple @@ -93,7 +93,7 @@ def acceptmessage(berichtid, moderatorid): date = datetime.datetime.utcnow().strftime("%Y-%m-%d") QUERY = "UPDATE berichten SET statusid = 4, datumgekeurd = (%s), tijdgekeurd = (%s), moderatorid = (%s) WHERE berichtid = (%s)" - DATA = (date, time, berichtid, moderatorid) + DATA = (date, time, moderatorid, berichtid) cur.execute(QUERY, DATA) conn.commit() return True @@ -104,7 +104,7 @@ def rejectmessage(berichtid, moderatorid): date = datetime.datetime.utcnow().strftime("%Y-%m-%d") QUERY = "UPDATE berichten SET statusid = 3, datumgekeurd = (%s), tijdgekeurd = (%s), moderatorid = (%s) WHERE berichtid = (%s)" - DATA = (date, time, berichtid, moderatorid) + DATA = (date, time, moderatorid, berichtid) cur.execute(QUERY, DATA) conn.commit() return True @@ -121,10 +121,12 @@ def moderateloop(): nadat de bericht is goedgekeurt direct de functie publishtwit(berichtid) en loopt weer verder """ + moderatorid = 1 + while True: exitvar = False - bericht = getmessage() + bericht = getmessage(moderatorid) if bericht == False: print('Er zijn geen berichten meer om te weergeven, probeer het later opnieuw') @@ -137,13 +139,15 @@ def moderateloop(): try: modinput = input('r = reject, a = accept, q = quit: ').lower() if modinput == 'r': - rejectmessage(bericht[0]) + rejectmessage(bericht[0], moderatorid) exitvar = True elif modinput == 'a': - acceptmessage(bericht[0]) + acceptmessage(bericht[0], moderatorid) exitvar = True elif modinput == 'q': unlockmessage(bericht[0]) return True except: - print('Ongeldige invoer') \ No newline at end of file + print('Ongeldige invoer') + +moderateloop() \ No newline at end of file