From fe4e8bf64435cd783722dc89cd6e499b7078ab2c Mon Sep 17 00:00:00 2001 From: vindimy Date: Sun, 8 Dec 2013 02:25:53 +0000 Subject: [PATCH] Processing messages from oldest to newest --- src/cointipbot.py | 3 ++- src/ctb/ctb_stats.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cointipbot.py b/src/cointipbot.py index 9656ec8..3bd55c5 100644 --- a/src/cointipbot.py +++ b/src/cointipbot.py @@ -195,7 +195,8 @@ def check_inbox(self): try: # Try to fetch some messages - messages = ctb_misc.praw_call(self.reddit.get_unread, limit=self.conf.reddit.scan.batch_limit) + messages = list(ctb_misc.praw_call(self.reddit.get_unread, limit=self.conf.reddit.scan.batch_limit)) + messages.reverse() # Process messages for m in messages: diff --git a/src/ctb/ctb_stats.py b/src/ctb/ctb_stats.py index ee257a7..0b1d178 100644 --- a/src/ctb/ctb_stats.py +++ b/src/ctb/ctb_stats.py @@ -186,9 +186,9 @@ def update_user_stats(ctb=None, username=None): num_received = 0 for m in history: if m['state'] == 'completed': - if m['from_user'] == username: + if m['from_user'].lower() == username.lower(): num_tipped += 1 - elif m['to_user'] == username: + elif m['to_user'].lower() == username.lower(): num_received += 1 values = [] for k in history.keys():