From e12069b45d2919a547d569ee35233d7addbdfa3b Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 19 Sep 2013 06:38:37 -0700 Subject: [PATCH] fix to work with devids and devtypes being arrays --- xwords4/relay/scripts/gcm_loop.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xwords4/relay/scripts/gcm_loop.py b/xwords4/relay/scripts/gcm_loop.py index cdd4a3b61..beb8a8f67 100755 --- a/xwords4/relay/scripts/gcm_loop.py +++ b/xwords4/relay/scripts/gcm_loop.py @@ -57,7 +57,7 @@ def init(): def getPendingMsgs( con, typ ): cur = con.cursor() query = """SELECT %s FROM msgs - WHERE devid IN (SELECT id FROM devices WHERE devtype=%d and NOT unreg) + WHERE devid IN (SELECT id FROM devices WHERE devtypes[1]=%d and NOT unreg) AND NOT connname IN (SELECT connname FROM games WHERE dead); """ cur.execute(query % (",".join( g_columns ), typ)) @@ -104,7 +104,7 @@ def unregister( gcmid ): def asGCMIds(con, devids, typ): cur = con.cursor() - query = "SELECT devid FROM devices WHERE devtype = %d AND id IN (%s)" \ + query = "SELECT devids[1] FROM devices WHERE devtypes[1] = %d AND id IN (%s)" \ % (typ, ",".join([str(y) for y in devids])) cur.execute( query ) return [elem[0] for elem in cur.fetchall()]