Exemple #1
0
def career_record(mobile, carrier, manager, opponent, week, year, type):
    """Returns career record (including playoffs) of two opponents"""

    query = "select count(*) from (select * from scoreboard_all where (manager1_name = '{0}' and manager2_name = '{1}')\
             or (manager2_name = '{0}' and manager1_name = '{1}')) where team1_points>0 and type='{2}' and (week!={3} or\
             year!= {4});".format(manager, opponent, type, week, year)
    x = int(db.fetch_one(query))

    query = "select count(*) from (select * from scoreboard_all where ((manager1_name = '{0}' and manager2_name = '{1}' \
             and team1_points > team2_points) or (manager2_name = '{0}' AND manager1_name = '{1}' and \
             team2_points > team1_points))) where type = '{2}' and (week != {3} OR year != {4})".format(
             manager, opponent, type, week, year)
    y = int(db.fetch_one(query))

    try:
        career_winning_percentage = '{:.2%}'.format(float(y) / float(x))
    except ZeroDivisionError:
        career_winning_percentage = 0
    wins = str(y)
    losses = str(x - y)
    message = "{0}, today you play {1} in fantasy. Your career winning % is {2} with a record of {3}-{4}.".format(
        manager, opponent, career_winning_percentage, wins, losses)

    for mob, car in zip(mobile, carrier):
        send_text(mob, message, car)
Exemple #2
0
def stubhub_check():
    month = datetime.now().month
    stubhub = True

    if stubhub and month in [7, 8, 9, 10]:
        sql1 = "select max(season) from expense;"
        sql2 = "select max(strftime('%Y', eventdate)) from all_wild;"
        ticket_year = int(stubhub_db.c.execute(sql1).fetchone()[0])
        expense_year = int(stubhub_db.c.execute(sql2).fetchone()[0])

        if ticket_year != expense_year:
            cred = ServerCredentials()
            send_text(cred.cell, 'Add expenses for wild tickets season {}'.format(ticket_year), 'ATT')
Exemple #3
0
def fantasy_check():
    fantasy = True
    month = datetime.now().month
    year = datetime.now().year

    if fantasy and month in [6, 7, 8]:

        year_ex = yahoo_db.c.execute("select max(year) as year from leagues where type = 'EX';").fetchone()[0]
        year_lm = yahoo_db.c.execute("select max(year) as year from leagues where type = 'LM';").fetchone()[0]

        if year > year_ex:
            cred = ServerCredentials()
            send_text(cred.cell, 'Add league info for EX and LM', 'ATT')
        if year > year_lm:
            cred = ServerCredentials()
            send_text(cred.cell, 'Add league info for LM', 'ATT')

        year_ex_win = yahoo_db.c.execute("select max(year) from winnings where type = 'EX';").fetchall()[0]
        year_lm_win = yahoo_db.c.execute("select max(year) from winnings where type = 'LM';").fetchall()[1]

        if year > year_ex_win:
            cred = ServerCredentials()
            send_text(cred.cell, 'Add payout info for EX in table winnings', 'ATT')
        if year > year_lm_win:
            cred = ServerCredentials()
            send_text(cred.cell, 'Add payout info for LM in table winnigns', 'ATT')
Exemple #4
0
def current_projections(mobile, carrier, manager, prob):
    rate_win = '{:.2%}'.format(prob)
    message = "{0}, you are projected a {1} chance of victory".format(manager, rate_win)

    for mob, car in zip(mobile, carrier):
        send_text(mob, message, car)