Fix bug in colorize_streams that tried to include non-streams for colorizing.

(imported from commit 286a6ab38513303968b3c476ebd528a3ab2cacf1)
This commit is contained in:
Jessica McKellar 2013-03-03 13:15:50 -05:00
parent 7d97a739df
commit 30c7bdf018
1 changed files with 5 additions and 2 deletions

View File

@ -41,9 +41,12 @@ class Command(BaseCommand):
for user_profile in users_who_need_colors:
print " ", user_profile.full_name
stream_ids = [result['recipient__type_id'] for result in Message.objects.filter(
sender__realm=realm).values('recipient__type_id').annotate(
stream_ids = [result['recipient__type_id'] for result in \
Message.objects.filter(sender__realm=realm,
recipient__type=Recipient.STREAM)
.values('recipient__type_id').annotate(
count=Count('recipient__type_id')).order_by('-count')]
print "Setting color for:"
for stream_id, color in zip(stream_ids, colors):
# Give everyone the same color for a stream.