Exemplo n.º 1
0
 def cancel_match(match_id):
     paid_money = TicketDAO.get_paid_money(match_id)
     for card_id, price in paid_money:
         if card_id is not None:
             FanIDCardDAO.increase_balance(card_id, price)
     TicketDAO.delete_tickets_by_match_id(match_id)
     MatchDAO.delete_match(match_id)
Exemplo n.º 2
0
def enter_match_id_to_buy_ticket(message):
    global match_id
    try:
        match_id = int(message.text)
        if not MatchDAO.does_exist(match_id):
            send(
                message,
                "The entered match id does not exist. Please enter the match id again",
                enter_match_id_to_buy_ticket)
            return
        available_seats = get_available_seats(match_id)
        if available_seats == "":
            send(
                message,
                "There are no available seats for this match. Please choose another match",
                enter_match_id_to_buy_ticket)
            return
        send(
            message,
            "Choose an available seat for this match. Your balance: ${}".
            format(round(user.person.fan_id_card.balance, 2)))
        send(message, available_seats, choose_seat)
    except ValueError:
        send(message,
             "Match ID must be an integer. Please enter the match id again",
             enter_match_id_to_buy_ticket)
Exemplo n.º 3
0
 def add_match(match):
     new_match_id = MatchDAO.add_match(match)
     match.id = new_match_id
     seats = Seat.get_seats()
     for seat in seats:
         price = 20 * seat.block + 5 * seat.row + 3 * seat.place + 0.99
         ticket = SingleTicket(None, None, price, match, seat)
         TicketDAO.add_ticket(ticket)
Exemplo n.º 4
0
def enter_match_id_to_delete(message):
    try:
        match_id = int(message.text)
        if not MatchDAO.does_exist(match_id):
            raise MatchDoesNotExistError()
        user.person.delete_match(match_id)
        send(message, "The match {} was successfully deleted".format(match_id))
    except ValueError:
        send(message,
             "Match ID must be an integer. Please enter the match ID again",
             enter_match_id_to_delete)
    except MatchDoesNotExistError:
        send(
            message,
            "The entered match ID does not exist. Please enter the match ID again",
            enter_match_id_to_delete)
Exemplo n.º 5
0
 def save(self):
     MatchDAO.update_match(self)
Exemplo n.º 6
0
 def construct(match_id):
     if not MatchDAO.does_exist(match_id):
         raise MatchDoesNotExistError()
     row = MatchDAO.get_by_id(match_id)
     return Match(row[0], row[1], row[2], row[3], row[4], row[5])
Exemplo n.º 7
0
def get_matches():
    result = MatchDAO.get_matches()
    matches = ""
    for row in result:
        matches += str(Match(*row)) + "\n\n"
    return matches
Exemplo n.º 8
0
 def delete_match(match_id):
     TicketDAO.delete_tickets_by_match_id(match_id)
     MatchDAO.delete_match(match_id)
Exemplo n.º 9
0
 def update_match(match):
     MatchDAO.update_match(match)