This commit is contained in:
spla 2020-11-20 15:06:14 +01:00
pare a534f67c49
commit a6ca40b4b7

Veure arxiu

@ -239,6 +239,8 @@ def current_games():
game_link_lst = [] game_link_lst = []
next_move_lst = []
try: try:
conn = None conn = None
@ -247,7 +249,7 @@ def current_games():
cur = conn.cursor() cur = conn.cursor()
cur.execute("select white_user, black_user, chess_status, chess_link from games where not finished") cur.execute("select white_user, black_user, chess_status, chess_link, next_move from games where not finished")
rows = cur.fetchall() rows = cur.fetchall()
@ -267,9 +269,11 @@ def current_games():
game_link_lst.append(row[3]) game_link_lst.append(row[3])
next_move_lst.append(row[4])
cur.close() cur.close()
return (player1_name_lst, player2_name_lst, game_status_lst, game_link_lst) return (player1_name_lst, player2_name_lst, game_status_lst, game_link_lst, next_move_lst)
except (Exception, psycopg2.DatabaseError) as error: except (Exception, psycopg2.DatabaseError) as error:
@ -1199,7 +1203,7 @@ if __name__ == '__main__':
elif query_word == 'jocs': elif query_word == 'jocs':
player1_name_lst, player2_name_lst, game_status_lst, game_link_lst = current_games() player1_name_lst, player2_name_lst, game_status_lst, game_link_lst, next_move_lst = current_games()
if len(player1_name_lst) > 0: if len(player1_name_lst) > 0:
@ -1214,7 +1218,13 @@ if __name__ == '__main__':
else: else:
toot_text += "\n" + player1_name_lst[i] + " / " + player2_name_lst[i] + " (en joc)" + "\n" if next_move_lst[i] == player1_name_lst[i]:
toot_text += "\n*" + player1_name_lst[i] + " / " + player2_name_lst[i] + " (en joc)" + "\n"
else:
toot_text += "\n" + player1_name_lst[i] + " / *" + player2_name_lst[i] + " (en joc)" + "\n"
if game_link_lst[i] != None: if game_link_lst[i] != None: