From a6d8708abce4a72223dd51836d6d6d7c0b1612a3 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 31 Aug 2017 20:07:40 -0700 Subject: [PATCH] sort unconnected games to top of list --- .../src/main/java/org/eehouse/android/xw4/DBUtils.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java index 5ac2fc34c..bc60ce11d 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java @@ -1622,8 +1622,12 @@ public class DBUtils { initDB( context ); String[] columns = { ROW_ID }; String selection = String.format( "%s=%d", DBHelper.GROUPID, groupID ); - String orderBy = String.format( "%s,%s DESC,%s", DBHelper.GAME_OVER, - DBHelper.TURN_LOCAL, DBHelper.LASTMOVE ); + // Sort unconnected games at top (turn==-1), games that are finished + // at the bottom, then games at the top by how long it's been the + // device owner's turn. + String orderBy = String.format( "%s is -1 DESC,%s,%s DESC,%s", DBHelper.TURN, + DBHelper.GAME_OVER, DBHelper.TURN_LOCAL, + DBHelper.LASTMOVE ); synchronized( s_dbHelper ) { Cursor cursor = s_db.query( DBHelper.TABLE_NAME_SUM, columns, selection, // selection