示例#1
0
 def tick(self):
     i = self.top
     for t in Team.from_game(self.game):
         self.screen.addstr(i, self.left, t.emoji)
         self.screen.addstr(i, self.left + 2, t.name)
         self.screen.addstr(i, self.left + 27, str(int(t.odds * 100)) + "%")
         i = i + 1
示例#2
0
 def tick(self):
     i = self.top
     for t in Team.from_game(self.game):
         self.screen.addstr(i, self.left, t.emoji)
         self.screen.addstr(i, self.left + 2, t.name)
         self.screen.addstr(i, self.left + 29, str(t.score))
         i = i + 1
示例#3
0
def add_team(session, name_in, state_id_in, color_id_in, wins_in, losses_in):
    from main import State, Team, Color, Player
    new_team = Team(name=name_in,
                    state_id=int(state_id_in),
                    color_id=int(color_id_in),
                    wins=int(wins_in),
                    losses=int(losses_in))
    session.add(new_team)
    session.commit()
    return
from main import Team, Banner

for team in Team.all():
    team.delete()

for banner in Banner.all():
    banner.delete()

teams = [
    'Arsenal',
    'Aston Villa',
    'Birmingham City',
    'Blackburn Rovers',
    'Blackpool',
    'Bolton Wanderers',
    'Chelsea',
    'Everton',
    'Fulham',
    'Liverpool',
    'Manchester City',
    'Manchester United',
    'Newcastle United',
    'Stoke City',
    'Sunderland',
    'Tottenham Hotspur',
    'West Bromwich Albion',
    'West Ham United',
    'Wigan Athletic',
    'Wolverhampton Wanderers',
]
示例#5
0
    def get(self):
        
        resultlog = []
        
        for team in Team.all():
            team.delete()

        for banner in Banner.all():
            banner.delete()

        teams = [
            'Arsenal',
            'Aston Villa',
            'Birmingham City',
            'Blackburn Rovers',
            'Blackpool',
            'Bolton Wanderers',
            'Chelsea',
            'Everton',
            'Fulham',
            'Liverpool',
            'Manchester City',
            'Manchester United',
            'Newcastle United',
            'Stoke City',
            'Sunderland',
            'Tottenham Hotspur',
            'West Bromwich Albion',
            'West Ham United',
            'Wigan Athletic',
            'Wolverhampton Wanderers',
        ]

        for team in teams:
            t = Team(name=team, key_name=team, enabled=True)
            t.put()
            resultlog.append('Team with name \"%s\" created.' %t.name)


        random_banter = [
            '%s fans should better find a new team.',
            'I can\'t understand how %s call themselves a team.',
            'A footbal team? I thought you said %s.',
        ]

        resultlog.append('')
        
        impressions = int(self.request.get('impressions', default_value=2000))
        
        for team in teams:
            for banter in random_banter:
                b = Banner(
                    copy = banter %team,
                    team = Team.get_by_key_name(team),
                    author_id = 'leoncoto',
                    impressions = impressions
                )
                b.put()
                resultlog.append('New banter banner')
                resultlog.append('Banter: %s' %b.copy)
                resultlog.append('Sent to: %s' %b.team.name)
                resultlog.append('Impressions left: %i' %b.impressions)
                resultlog.append('')
            resultlog.append('')   

        template_values = {'resultlog' : resultlog }
        path = os.path.join(os.path.dirname(__file__), 'templates/pupulate.html')
        template_render = template.render(path, template_values)
        self.response.out.write(template_render)        
示例#6
0
from main import Banner, Team
import main

team = Team.get_by_key_name('Birmingham City')
print 'Banners for the %s team' % team.name

banner = main.get_banner_for_team(team)

if banner:
    print banner.copy
else:
    print 'All of the banners for the %s team have run out of impressions' % team.name
示例#7
0
    def get(self):

        resultlog = []

        for team in Team.all():
            team.delete()

        for banner in Banner.all():
            banner.delete()

        teams = [
            'Arsenal',
            'Aston Villa',
            'Birmingham City',
            'Blackburn Rovers',
            'Blackpool',
            'Bolton Wanderers',
            'Chelsea',
            'Everton',
            'Fulham',
            'Liverpool',
            'Manchester City',
            'Manchester United',
            'Newcastle United',
            'Stoke City',
            'Sunderland',
            'Tottenham Hotspur',
            'West Bromwich Albion',
            'West Ham United',
            'Wigan Athletic',
            'Wolverhampton Wanderers',
        ]

        for team in teams:
            t = Team(name=team, key_name=team, enabled=True)
            t.put()
            resultlog.append('Team with name \"%s\" created.' % t.name)

        random_banter = [
            '%s fans should better find a new team.',
            'I can\'t understand how %s call themselves a team.',
            'A footbal team? I thought you said %s.',
        ]

        resultlog.append('')

        impressions = int(self.request.get('impressions', default_value=2000))

        for team in teams:
            for banter in random_banter:
                b = Banner(copy=banter % team,
                           team=Team.get_by_key_name(team),
                           author_id='leoncoto',
                           impressions=impressions)
                b.put()
                resultlog.append('New banter banner')
                resultlog.append('Banter: %s' % b.copy)
                resultlog.append('Sent to: %s' % b.team.name)
                resultlog.append('Impressions left: %i' % b.impressions)
                resultlog.append('')
            resultlog.append('')

        template_values = {'resultlog': resultlog}
        path = os.path.join(os.path.dirname(__file__),
                            'templates/pupulate.html')
        template_render = template.render(path, template_values)
        self.response.out.write(template_render)