예제 #1
0
def _game_finished(recipient, screenname, identity, game):
    """
    Lets recipient know their game has finished and analysis is ready.
    """
    msg = Message("Analysis for Game %d on Range vs. Range" % (game.gameid, ))
    msg.add_recipient(recipient)
    msg.html = render_template('email/game_complete.html',
                               recipient=recipient,
                               screenname=screenname,
                               unsubscribe=make_unsubscribe_url(identity),
                               game_url=make_game_url(str(game.gameid)),
                               gameid=game.gameid)
    send_email(msg)
예제 #2
0
def _game_started(recipient, screenname, identity, is_starter, is_acting,
                  game):
    """
    Lets recipient know their game has started.
    """
    msg = Message("Game %d has started on Range vs. Range" %
                  (game.gameid,))
    msg.add_recipient(recipient)
    msg.html = render_template('email/game_started.html',
        recipient=recipient, screenname=screenname, is_starter=is_starter,
        is_acting=is_acting, unsubscribe=make_unsubscribe_url(identity),
        game_url=make_game_url(str(game.gameid), login=True),
        gameid=game.gameid)
    send_email(msg)
예제 #3
0
def _game_started(recipient, screenname, identity, is_starter, is_acting,
                  game):
    """
    Lets recipient know their game has started.
    """
    msg = Message("Game %d has started on Range vs. Range" % (game.gameid, ))
    msg.add_recipient(recipient)
    msg.html = render_template('email/game_started.html',
                               recipient=recipient,
                               screenname=screenname,
                               is_starter=is_starter,
                               is_acting=is_acting,
                               unsubscribe=make_unsubscribe_url(identity),
                               game_url=make_game_url(str(game.gameid)),
                               gameid=game.gameid)
    send_email(msg)
예제 #4
0
def _your_turn(recipient, screenname, identity, game):
    """
    Lets recipient know it's their turn in a game.

    The identity is used to create the unsubscribe link. We can safely use
    that to identify the user in plain text, because they get to see it
    anyway during authentication.

    Uses Flask-Mail; sends asynchronously.
    """
    msg = Message("It's your turn in Game %d on Range vs. Range" %
                  (game.gameid,))
    msg.add_recipient(recipient)
    msg.html = render_template('email/your_turn.html', recipient=recipient,
       screenname=screenname, unsubscribe=make_unsubscribe_url(identity),
       game_url=make_game_url(str(game.gameid), login=True), gameid=game.gameid)
    send_email(msg)
예제 #5
0
def _your_turn(recipient, screenname, identity, game):
    """
    Lets recipient know it's their turn in a game.

    The identity is used to create the unsubscribe link. We can safely use
    that to identify the user in plain text, because they get to see it
    anyway during authentication.
    
    Uses Flask-Mail; sends asynchronously.
    """
    msg = Message("It's your turn in Game %d on Range vs. Range" %
                  (game.gameid, ))
    msg.add_recipient(recipient)
    msg.html = render_template('email/your_turn.html',
                               recipient=recipient,
                               screenname=screenname,
                               unsubscribe=make_unsubscribe_url(identity),
                               game_url=make_game_url(str(game.gameid)),
                               gameid=game.gameid)
    send_email(msg)
예제 #6
0
def _game_finished(recipient, screenname, identity, game):
    """
    Lets recipient know their game has finished and analysis is ready.

    This email gets sent even if the user is unsubscribed, because it just sucks
    so much when you miss one.
    """
    msg = Message("Analysis for Game %d on Range vs. Range" %
                  (game.gameid,))
    msg.add_recipient(recipient)
    results = []
    for rgp in game.rgps:
        items = {rgpr.scheme: rgpr.result for rgpr in rgp.results}
        results.append((rgp.user.screenname,
                        items[RunningGameParticipantResult.SCHEME_EV]))
    msg.html = render_template('email/game_complete.html',
        recipient=recipient, screenname=screenname,
        unsubscribe=make_unsubscribe_url(identity),
        game_url=make_game_url(str(game.gameid)), gameid=game.gameid,
        results=results)
    send_email(msg)