Ejemplo n.º 1
0
 def get(self):
     games = memcache.get('gamedates')
     if not games:
         games = GameDate.all()
         games.order('date')
     game = games[0]
     players = memcache.get('players')
     if not players:
         players = Player.all()
         players.order('lname')
         players.order('fname')
         memcache.set('players', players)
     to_list = []
     for player in players:
         if not player.sub:
             to_list.append(player.email)
     email_sender = "Esri Hockey <*****@*****.**>"
     email_subject = "Esri Hockey - %d/%d/%d" % (
         game.date.month, game.date.day, game.date.year)
     email_body = """Head on over to http://esrihockey.appspot.com to let us know if you are in or out."""
     if not game.isThisWeek():
         logging.info("NOT GAME THIS WEEK")
         email_subject = "Esri Hockey - No Game This Week"
         email_body = """Reminder we are off this week. Our next game will be %d/%d/%d.""" % (
             game.date.month, game.date.day, game.date.year)
     mail.send_mail(sender=email_sender,
                    to=to_list,
                    subject=email_subject,
                    body=email_body)
Ejemplo n.º 2
0
def updateCurrentGames():
    games = memcache.get('gamedates')
    if not games:
        games = GameDate.all()
        games.order('date')
    current_games = []
    deletedGame = False
    now = localTime()
    datetimenow = datetime.datetime(month=now.month,
                                    year=now.year,
                                    day=now.day)
    for game in games:
        #if game.date.month <= now.month and game.date.day < now.day and game.date.year <= now.year:
        if game.date < datetimenow:
            game.delete()
            deletedGame = True
        else:
            current_games.append(game)
    # when we delete a game, we should also
    # reset all players to be OUT and NOT goalie
    if deletedGame:
        players = Player.all()
        for player in players:
            player.inThisWeek = False
            if not player.sub:
                player.goalie = False
            player.team = ""
            player.put()
        memcache.set('players', players)
        comments = Comment.all()
        for comment in comments:
            comment.delete()
    return current_games
Ejemplo n.º 3
0
def updateCurrentGames():
    games = memcache.get("gamedates")
    if not games:
        games = GameDate.all()
        games.order("date")
    current_games = []
    deletedGame = False
    now = localTime()
    datetimenow = datetime.datetime(month=now.month, year=now.year, day=now.day)
    for game in games:
        # if game.date.month <= now.month and game.date.day < now.day and game.date.year <= now.year:
        if game.date < datetimenow:
            game.delete()
            deletedGame = True
        else:
            current_games.append(game)
            # when we delete a game, we should also
            # reset all players to be OUT and NOT goalie
    if deletedGame:
        players = Player.all()
        for player in players:
            player.inThisWeek = False
            if not player.sub:
                player.goalie = False
            player.team = ""
            player.put()
        memcache.set("players", players)
        comments = Comment.all()
        for comment in comments:
            comment.delete()
    return current_games
Ejemplo n.º 4
0
	def get(self):
		games = memcache.get('gamedates')
		if not games:
			games = GameDate.all()
			games.order('date')
		game = games[0]
		players = memcache.get('players')
		if not players:
			players = Player.all()
			players.order('lname')
			players.order('fname')
			memcache.set('players', players)
		to_list = []
		for player in players:
			if not player.sub:
				to_list.append(player.email)
		email_sender = "Esri Hockey <*****@*****.**>"
		email_subject = "Esri Hockey - %d/%d/%d" % (game.date.month, game.date.day, game.date.year)
		email_body = """Head on over to http://esrihockey.appspot.com to let us know if you are in or out."""		
		if not game.isThisWeek():
			logging.info("NOT GAME THIS WEEK")
			email_subject = "Esri Hockey - No Game This Week"
			email_body = """Reminder we are off this week. Our next game will be %d/%d/%d.""" % (game.date.month, game.date.day, game.date.year)
		mail.send_mail(sender=email_sender, to=to_list, subject=email_subject, body=email_body)
Ejemplo n.º 5
0
def GetAllGames():
    games = memcache.get('gamedates')
    if not games:
        games = GameDate.all()
        games.order('date')
    return games
Ejemplo n.º 6
0
def GetAllGames():
    games = memcache.get("gamedates")
    if not games:
        games = GameDate.all()
        games.order("date")
    return games