Storycraft: don't flood the target with storycraft_listgames, display only ids if count > 5

This commit is contained in:
Brian S. Stephan 2011-01-09 11:12:27 -06:00
parent fd22cb64d4
commit 797f660a9e

View File

@ -288,15 +288,18 @@ class Storycraft(Module):
if category == 'open': if category == 'open':
games = self._get_open_games() games = self._get_open_games()
gamestrs = []
for game in games:
gamestrs.append(self._get_game_summary(game))
return '\n'.join(gamestrs)
elif category == 'in progress': elif category == 'in progress':
games = self._get_in_progress_games() games = self._get_in_progress_games()
if len(games) > 5:
# just list the game ids
gameids = []
for game in games:
gameids.append(str(game.id))
return 'Too many to list! ids: ' + ','.join(gameids)
else:
# show game details, since there's not many
gamestrs = [] gamestrs = []
for game in games: for game in games:
gamestrs.append(self._get_game_summary(game)) gamestrs.append(self._get_game_summary(game))