def top_groups(self, num_groups=10): from smarttypes.model.twitter_group import TwitterGroup return_list = [] i = 0 for score, group_id in sorted(self.scores_groups, reverse=True): if i <= num_groups and score > .001: return_list.append((score, TwitterGroup.get_by_index(group_id, self.postgres_handle))) else: break i += 1 return return_list
def group_details(req, session, postgres_handle): if 'group_index' in req.params and 'reduction_id' in req.params: reduction = TwitterReduction.get_by_id(req.params['reduction_id'], postgres_handle) group_index = int(req.params['group_index']) twitter_group = TwitterGroup.get_by_index(reduction.id, group_index, postgres_handle) else: twitter_group = None return { 'template_path': 'social_map/group_details.html', 'twitter_group': twitter_group, }
def group(request): if 'group_index' in request.params: group_index = int(request.params['group_index']) twitter_group = TwitterGroup.get_by_index(group_index) else: twitter_group = TwitterGroup.get_random_group() return { 'twitter_group':twitter_group, }