Fixed stupid failed tests in Notes. I'm retard.

This commit is contained in:
Jeremy Fincher 2003-09-05 19:01:02 +00:00
parent dd6f5de32e
commit 0f843dd651

View File

@ -150,22 +150,21 @@ class Notes(callbacks.Privmsg):
notes.to_id=users.id AND notes.to_id=users.id AND
notified=0""", name) notified=0""", name)
unnotified = int(cursor.fetchone()[0]) unnotified = int(cursor.fetchone()[0])
if unnotified == 0: if unnotified != 0:
return cursor.execute("""SELECT COUNT(*) FROM notes, users
cursor.execute("""SELECT COUNT(*) FROM notes, users WHERE users.name=%s AND
WHERE users.name=%s AND notes.to_id=users.id AND
notes.to_id=users.id AND read=0""", name)
read=0""", name) unread = int(cursor.fetchone()[0])
unread = int(cursor.fetchone()[0]) s = 'You have %s; ' \
s = 'You have %s; ' \ '%s that I haven\'t told you about before now..' % \
'%s that I haven\'t told you about before now..' % \ (utils.nItems(unread, 'note', 'unread'), unnotified)
(utils.nItems(unread, 'note', 'unread'), unnotified) irc.queueMsg(ircmsgs.privmsg(msg.nick, s))
irc.queueMsg(ircmsgs.privmsg(msg.nick, s)) cursor.execute("""UPDATE notes
cursor.execute("""UPDATE notes SET notified=1
SET notified=1 WHERE notes.to_id=(SELECT id
WHERE notes.to_id=(SELECT id FROM users
FROM users WHERE name=%s)""", name)
WHERE name=%s)""", name)
callbacks.Privmsg.doPrivmsg(self, irc, msg) callbacks.Privmsg.doPrivmsg(self, irc, msg)
def sendnote(self, irc, msg, args): def sendnote(self, irc, msg, args):