예제 #1
0
def remove(table, id_):
    """
    Remove a record with a given id from the table.

    Args:
        table (list): table to remove a record from
        id_ (str): id of a record to be removed

    Returns:
        list: Table without specified record.
    """
    common.remove("store/games.csv", table, id_)
    return table
예제 #2
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    # your code
    while True:
        
        title = "Inventory module"
        exit_message = "Exit to main"
        options = ["Show table",
                    "Add item",
                    "Remove item",
                    "Update item",
                    "Available items",
                    "Avg durability by manufacturer"]
        ui.print_menu(title, options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "/home/frojim/Documents/CC/lightweight-erp-python-extremely-random-programmers/inventory/inventory.csv"
        table = data_manager.get_table_from_file(file_name)
        title_list = ['id', 'title', 'manufacturer', 'purchase_year', 'durability']
        questions_asked = ['title: ', 'manufacturer: ', 'purchase_year: ', 'durability: ']
        unique_id = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, questions_asked)
        elif option == "3":
            common.remove(table, unique_id, title_list)
        elif option == "4":
            common.update(table, unique_id, title_list)
        elif option == "5":
            get_available_items(table, year)
        elif option == "6":
            get_average_durability_by_manufacturers(table)
        elif option == "0":
            break




    return table
예제 #3
0
파일: crm.py 프로젝트: erikaZToth/ERP_v2
def remove(table, id_):
    """
    Remove a record with a given id from the table.
    Args:
        table (list): table to remove a record from
        id_ (str): id of a record to be removed
    Returns:
        list: Table without specified record.
    """

    # your code
    file_name = "crm/customers.csv"
    common.remove(table, id_, file_name)

    return table
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    while True:
        title = "Sales manager"
        exit_message = "(0) Back to main menu"
        list_options = [
            "(1) Show table", "(2) Add", "(3) Remove", "(4) Update",
            "(5) Cheapo game", "(6) Items sold between", "(7) Get title by ID",
            "(8) Get item ID sold last"
        ]
        ui.print_menu(title, list_options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "sales/sales.csv"
        title_list = ["id", "title", "price", "month", "day", "year"]
        table = data_manager.get_table_from_file(file_name)
        list_titles = ["month: ", "day: ", "year: ", "type: ", "amount: "]
        id_ = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, list_titles, file_name)
        elif option == "3":
            common.remove(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "4":
            common.update(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "5":
            get_lowest_price_item_id(table)
        elif option == "6":
            get_items_sold_between(table, month_from, day_from, year_from,
                                   month_to, day_to, year_to)
        elif option == "7":
            get_title_by_id_from_table(table, ui.get_inputs(["ID: "], "")[0])
        elif option == "8":
            get_item_id_sold_last(table)
        elif option == "0":
            break
예제 #5
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    # your code

    while True:

        title = "Customer Relationship Management module"
        exit_message = "Exit to main"
        options = [
            "Show table", "Add item", "Remove item", "Update item",
            "Longest name", "Subscription"
        ]
        ui.print_menu(title, options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "/home/frojim/Documents/CC/lightweight-erp-python-extremely-random-programmers/crm/customers.csv"
        table = data_manager.get_table_from_file(file_name)
        title_list = ['id', 'name', 'email', 'subscribed']
        questions_asked = ['name: ', 'email: ', 'subscribed: ']
        unique_id = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, questions_asked)
        elif option == "3":
            common.remove(table, unique_id, title_list)
        elif option == "4":
            common.update(table, unique_id, title_list)
        elif option == "5":
            get_longest_name_id(table)
        elif option == "6":
            get_subscribed_emails(table)
        elif option == "0":
            break
예제 #6
0
파일: hr.py 프로젝트: frojim/ERP
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    # your code

    while True:

        title = "Human resources module"
        exit_message = "Exit to main"
        options = [
            "Show table", "Add item", "Remove item", "Update item",
            "Oldest person", "Avg aged person"
        ]
        ui.print_menu(title, options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "/home/frojim/Documents/CC/lightweight-erp-python-extremely-random-programmers/hr/persons.csv"
        table = data_manager.get_table_from_file(file_name)
        title_list = ['id', 'name', 'birth_year']
        questions_asked = ['name: ', 'birth_year: ']
        unique_id = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, questions_asked)
        elif option == "3":
            common.remove(table, unique_id, title_list)
        elif option == "4":
            common.update(table, unique_id, title_list)
        elif option == "5":
            get_oldest_person(table)
        elif option == "6":
            get_persons_closest_to_average(table)
        elif option == "0":
            break
예제 #7
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    # your code
    while True:

        title = "Sales module"
        exit_message = "Exit to main"
        options = [
            "Show table", "Add item", "Remove item", "Update item",
            "Lowest priced item", "Items sold by date"
        ]
        ui.print_menu(title, options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "/home/frojim/Documents/CC/lightweight-erp-python-extremely-random-programmers/sales/sales.csv"
        table = data_manager.get_table_from_file(file_name)
        title_list = ['id', 'title', 'price', 'month', 'day', 'year']
        questions_asked = ["title: ", "price: ", "month: ", "day: ", "year: "]
        unique_id = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, questions_asked)
        elif option == "3":
            common.remove(table, unique_id, title_list)
        elif option == "4":
            common.update(table, unique_id, title_list)
        elif option == "5":
            get_lowest_price_item_id(table)
        elif option == "6":
            get_items_sold_between(table, month_from, day_from, year_from,
                                   month_to, day_to, year_to)
        elif option == "0":
            break
예제 #8
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    # you code

    while True:

        title = "Accounting module"
        exit_message = "Exit to main"
        options = [
            "Show table", "Add item", "Remove item", "Update item",
            "Highest profit year", "Avg profit by item"
        ]
        ui.print_menu(title, options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "/home/frojim/Documents/CC/lightweight-erp-python-extremely-random-programmers/accounting/items.csv"
        table = data_manager.get_table_from_file(file_name)
        title_list = ['id', 'month', 'day', 'year', 'type', 'amount']
        questions_asked = ['month: ', 'day: ', 'year: ', 'type: ', 'amount: ']
        unique_id = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, questions_asked)
        elif option == "3":
            common.remove(table, unique_id, title_list)
        elif option == "4":
            common.update(table, unique_id, title_list)
        elif option == "5":
            which_year_max(table)
        elif option == "6":
            avg_amount(table, year)
        elif option == "0":
            break
예제 #9
0
파일: store.py 프로젝트: frojim/ERP
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    while True:
        
        title = "Store module"
        exit_message = "Exit to main"
        options = ["Show table",
                    "Add item",
                    "Remove item",
                    "Update item",
                    "Games by manufacturers",
                    "Avg stock by manufacturer"]
        ui.print_menu(title, options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "/home/frojim/Documents/CC/lightweight-erp-python-extremely-random-programmers/store/games.csv"
        table = data_manager.get_table_from_file(file_name)
        title_list = ['id', 'title', 'manufacturer', 'price', 'in_stock']
        questions_asked = ['title: ', 'manufacturer: ', 'price: ', 'in_stock: ']
        unique_id = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, questions_asked)
        elif option == "3":
            common.remove(table, unique_id, title_list)
        elif option == "4":
            common.update(table, unique_id, title_list)
        elif option == "5":
            get_average_by_manufacturer(table, manufacturer)
        elif option == "6":
            get_counts_by_manufacturers(table)
        elif option == "0":
            break
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    while True:
        title = "CRM manager"
        exit_message = "(0) Back to main menu"
        list_options = [
            "(1) Show table", "(2) Add", "(3) Remove", "(4) Update",
            "(5) ID of longest name", "(6) subscribers",
            "(7) Customer name by ID"
        ]
        ui.print_menu(title, list_options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "crm/customers.csv"
        title_list = ["id", "name", "email", "subscribed"]
        table = data_manager.get_table_from_file(file_name)
        list_titles = ["name: ", "email: ", "subscriber (0/1): "]
        id_ = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, list_titles, file_name)
        elif option == "3":
            common.remove(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "4":
            common.update(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "5":
            get_longest_name_id(table)
        elif option == "6":
            get_subscribed_emails(table)
        elif option == "7":
            get_name_by_id_from_table(table, ui.get_inputs(["ID: "], "")[0])
        elif option == "0":
            break
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    while True:
        title = "Inventory manager"
        exit_message = "(0) Back to main menu"
        list_options = [
            "(1) Show table", "(2) Add", "(3) Remove", "(4) Update",
            "(5) Available items"
        ]
        ui.print_menu(title, list_options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "inventory/inventory.csv"
        title_list = [
            "id", "name", "manufacturer", "purchase year", "durability"
        ]
        list_titles = [
            "name: ", "manufacturer: ", "purchase year: ", "durability: "
        ]
        table = data_manager.get_table_from_file(file_name)

        id_ = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, list_titles, file_name)
        elif option == "3":
            common.remove(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "4":
            common.update(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "5":
            get_available_items(table)
        elif option == "0":
            break
예제 #12
0
def start_module():
    """
    Starts this module and displays its menu.
    User can access default special features from here.
    User can go back to main menu from here.

    Returns:
        None
    """

    while True:
        title = "Data analyser"
        exit_message = "(0) Back to main menu"
        list_options = ["(1) Last buyer name",
                        "(2) Last buyer ID",
                        "(3) Buyer name spent most and the money spent",
                        "(4) Buyer ID spent most and the money spent",
                        "(5) The most frequent buyers names",
                        "(6) The most frequent buyers IDs"]

        ui.print_menu(title, list_options, exit_message)
        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "crm/customers.csv"
        title_list = ["id", "name", "email", "subscribed"]
        table = data_manager.get_table_from_file(file_name)
        list_titles = ["name: ", "email: ", "subscriber (0/1): "]
        id_ = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, list_titles, file_name)
        elif option == "3":
            common.remove(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "4":
            common.update(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "5":
            get_oldest_person(table)
        elif option == "6":
            get_persons_closest_to_average(table)
        elif option == "0":
            break
예제 #13
0
def choose():
    table = data_manager.get_table_from_file("crm/customers.csv")
    inputs = ui.get_inputs(["Please enter a number: "], "")
    option = inputs[0]
    if option == "0":
        return False
    elif option == "1":
        common.show_table(table, ["ID", "name", "email", "subscribed"])
    elif option == "2":
        common.add(
            "crm/customers.csv", table,
            ["Enter name: ", "Enter email: ", "Subscription (1/0 = yes/no): "])
    elif option == "3":
        id_ = ui.get_inputs(["Please enter an ID: "], "")
        common.remove("crm/customers.csv", table, id_)
    elif option == "4":
        id_ = ui.get_inputs(["Please enter an ID of a record to update: "], "")
        common.update("crm/customers.csv", table, id_)

    start_module()
예제 #14
0
def remove(table, id_):
    """
    Remove a record with a given id from the table.

    Args:
        table (list): table to remove a record from
        id_ (str): id of a record to be removed

    Returns:
        list: Table without specified record.
    """
    common.remove("sales/sales.csv", table, id_)
    # for row in table:
    #     if id_[0] == row[0]:
    #         inputs = ui.get_inputs([f"Do you want to delete this record ({' | '.join(row)})? [y/n] "], "")
    #         if inputs[0].lower() == "y":
    #             table.remove(row)
    #         else:
    #             continue
    # data_manager.write_table_to_file("sales/sales.csv", table)
    return table
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    while True:
        title = "HR manager"
        exit_message = "(0) Back to main menu"
        list_options = [
            "(1) Show table", "(2) Add", "(3) Remove", "(4) Update",
            "(5) Oldest Person", "(6) Age closest to average"
        ]
        ui.print_menu(title, list_options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "hr/persons.csv"
        title_list = ["id", "name", "birthyear"]
        table = data_manager.get_table_from_file(file_name)
        list_titles = ["name: ", "birth year: "]
        id_ = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, list_titles, file_name)
        elif option == "3":
            common.remove(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "4":
            common.update(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "5":
            get_oldest_person(table)
        elif option == "6":
            get_persons_closest_to_average(table)
        elif option == "0":
            break
예제 #16
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    while True:
        title = "Storage manager"
        exit_message = "(0) Back to main menu"
        list_options = [
            "(1) Show table", "(2) Add", "(3) Remove", "(4) Update",
            "(5) Counts by manufacturers"
        ]
        ui.print_menu(title, list_options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "store/games.csv"
        title_list = ["id", "title", "manufacturer", "price", "stock"]
        list_titles = ["title: ", "manufacturer: ", "price: ", "stock: "]
        table = data_manager.get_table_from_file(file_name)
        id_ = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, list_titles, file_name)
        elif option == "3":
            common.remove(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "4":
            common.update(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "5":
            get_counts_by_manufacturers(table)
        elif option == "0":
            break
def choose(menu):
    inputs = ui.get_inputs(["Please enter a number: "], "")
    option = inputs[0]
    if option == "1":
        show_table(
            ["Press ENTER to continue...", "Name", "E-mail", "Subscribed"],
            data_manager.get_table_from_file("crm/customers.csv"))
    elif option == "2":
        table = add(
            data_manager.get_table_from_file("crm/customers.csv"),
            ui.get_inputs([
                "Press ENTER to continue...", "Name: ", "E-mail: ",
                "Subscribed: "
            ], "Please provide the following information:"))
        data_manager.write_table_to_file("crm/customers.csv", table)
    elif option == "3":
        table = remove(
            data_manager.get_table_from_file("crm/customers.csv"),
            ui.get_inputs(["ID: "],
                          "Please provide the following information:"))
        data_manager.write_table_to_file("crm/customers.csv", table)
    elif option == "4":
        table = update(
            data_manager.get_table_from_file("crm/customers.csv"),
            ui.get_inputs(["ID"],
                          "Please provide the ID to identify the elemnt:"),
            ui.get_inputs([
                "ID", "Name", "E-mail", "Subscribed"
            ], "Please provide the following information to complete the update:"
                          ))
        data_manager.write_table_to_file("crm/customers.csv", table)
    elif option == "5":
        ui.print_result(
            get_longest_name_id(
                data_manager.get_table_from_file("crm/customers.csv")), "")
    elif option == "6":
        ui.print_result(
            get_subscribed_emails(
                data_manager.get_table_from_file("crm/customers.csv")), "")
    elif option == "7":
        ui.print_result(get_name_by_id("kH94Jc#&"), "")
    elif option == "8":
        pass

    elif option == "0":
        return False

    else:
        raise KeyError("There is no such option.")
    return True
def choose(menu):
    file_name = "store/games.csv"
    inputs = ui.get_inputs(["Please enter a number: "], "")
    option = inputs[0]
    main_list = [
        "Press ENTER to continue...", "Title: ", "Manifacturer: ", "Price: ",
        "In_stock: "
    ]
    if option == "1":
        show_table(main_list, data_manager.get_table_from_file(file_name))
    elif option == "2":
        table = add(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(main_list,
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "3":
        table = remove(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID: "],
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "4":
        table = update(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID"],
                          "Please provide the ID to identify the elemnt:"),
            ui.get_inputs(
                main_list,
                "Please provide the following information to complete the update"
            ))
        data_manager.write_table_to_file(file_name, table)
    elif option == "5":
        ui.print_result(
            get_counts_by_manufacturers(
                data_manager.get_table_from_file(file_name)), "")
    elif option == "6":
        manufacturer = ui.get_inputs([
            "Manifacturer: "
        ], "To calculate the avg. amount please specify which manifacturer you want to select."
                                     )[0]
        ui.print_result(
            get_average_by_manufacturer(
                data_manager.get_table_from_file(file_name), manufacturer), "")
    elif option == "0":
        return False

    else:
        raise KeyError("There is no such option.")
    return True
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None"""
    while True:
        title = "Accounting manager"
        exit_message = "(0) Back to main menu"
        list_options = [
            "(1) Show table", "(2) Add", "(3) Remove", "(4) Update",
            "(5) Max profits"
        ]
        ui.print_menu(title, list_options, exit_message)

        inputs = ui.get_inputs(["Please enter a number: "], "")
        option = inputs[0]
        file_name = "accounting/items.csv"
        title_list = ["id", "month", "day", "year", "type", "amount"]
        table = data_manager.get_table_from_file(file_name)
        list_titles = ["month: ", "day: ", "year: ", "type: ", "amount: "]
        id_ = ''

        if option == "1":
            common.show_table(table, title_list)
        elif option == "2":
            common.add(table, list_titles, file_name)
        elif option == "3":
            common.remove(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "4":
            common.update(table, ui.get_inputs(["ID: "], "")[0], file_name)
        elif option == "5":
            which_year_max(table)
        elif option == "0":
            break
def remove(table, id_):
    """
    Remove a record with a given id from the table.

    Args:
        table (list): table to remove a record from
        id_ (str): id of a record to be removed

    Returns:
        list: Table without specified record.
    """
    table= common.remove(table,id_)
    # your code

    return table
def choose(menu):
    file_name = "accounting/items.csv"
    inputs = ui.get_inputs(["Please enter a number: "], "")
    option = inputs[0]
    main_list = [
        "Press ENTER to continue...", "Month: ", "Day: ", "Year: ", "Type: ",
        "Amount: "
    ]
    if option == "1":
        show_table(main_list, data_manager.get_table_from_file(file_name))
    elif option == "2":
        table = add(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(main_list,
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "3":
        table = remove(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID: "],
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "4":
        table = update(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID"],
                          "Please provide the ID to identify the elemnt:"),
            ui.get_inputs(
                main_list,
                "Please provide the following information to complete the update"
            ))
        data_manager.write_table_to_file(file_name, table)
    elif option == "5":
        ui.print_result(
            which_year_max(
                data_manager.get_table_from_file("accounting/items.csv")), "")
    elif option == "6":
        s = int(ui.get_inputs("", ""))
        ui.print_result(
            avg_amount(
                data_manager.get_table_from_file("accounting/items.csv"), s),
            "")
    elif option == "0":
        return False

    else:
        raise KeyError("There is no such option.")
    return True
예제 #22
0
def choose(menu):
    file_name = "inventory/inventory.csv"
    inputs = ui.get_inputs(["Please enter a number: "], "")
    option = inputs[0]
    main_list = [
        "Press ENTER to continue...", "Name: ", "Manifacturer: ",
        "Purchase year: ", "Durability: "
    ]
    table = get_available_items(data_manager.get_table_from_file(file_name),
                                2006)
    if option == "1":
        show_table(main_list, data_manager.get_table_from_file(file_name))
    elif option == "2":
        table = add(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(main_list,
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "3":
        table = remove(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID: "],
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "4":
        table = update(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID"],
                          "Please provide the ID to identify the elemnt:"),
            ui.get_inputs(
                main_list,
                "Please provide the following information to complete the update:"
            ))
        data_manager.write_table_to_file(file_name, table)
    elif option == "5":
        list_of_items = [table[i][1] for i in range(len(table))]
        ui.print_result(list_of_items, "")
    elif option == "6":
        ui.print_result(
            get_average_durability_by_manufacturers(
                data_manager.get_table_from_file(file_name)), "")
    elif option == "0":
        return False

    else:
        raise KeyError("There is no such option.")
    return True
def choose(menu):
    file_name = "sales/sales.csv"
    inputs = ui.get_inputs(["Please enter a number: "], "")
    option = inputs[0]
    main_list = [
        "Press ENTER to continue...", "Title: ", "Price: ", "Month: ", "Day: ",
        "Year: "
    ]
    if option == "1":
        show_table(main_list, data_manager.get_table_from_file(file_name))
    elif option == "2":
        table = add(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(main_list,
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "3":
        table = remove(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID: "],
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "4":
        table = update(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID"],
                          "Please provide the ID to identify the elemnt:"),
            ui.get_inputs(
                main_list,
                "Please provide the following information to complete the update"
            ))
        data_manager.write_table_to_file(file_name, table)
    elif option == "5":
        ui.print_result(
            get_lowest_price_item_id(
                data_manager.get_table_from_file(file_name)), "")
    elif option == "6":
        ui.print_result(
            get_items_sold_between(
                data_manager.get_table_from_file("sales/sales.csv"), 10, 1,
                2015, 12, 12, 2016)[1], "")
    elif option == "0":
        return False

    else:
        raise KeyError("There is no such option.")
    return True
예제 #24
0
def choose(menu):
    file_name = "hr/persons.csv"
    inputs = ui.get_inputs(["Please enter a number: "], "")
    option = inputs[0]
    main_list = ["Press ENTER to continue...", "Name: ", "Birth year: "]
    if option == "1":
        show_table(main_list, data_manager.get_table_from_file(file_name))
    elif option == "2":
        table = add(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(main_list,
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "3":
        table = remove(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID: "],
                          "Please provide the following information:"))
        data_manager.write_table_to_file(file_name, table)
    elif option == "4":
        table = update(
            data_manager.get_table_from_file(file_name),
            ui.get_inputs(["ID"],
                          "Please provide the ID to identify the elemnt:"),
            ui.get_inputs(
                main_list,
                "Please provide the following information to complete the update:"
            ))
        data_manager.write_table_to_file(file_name, table)
    elif option == "5":
        ui.print_result(
            get_oldest_person(data_manager.get_table_from_file(file_name)), "")
    elif option == "6":
        ui.print_result(
            get_persons_closest_to_average(
                data_manager.get_table_from_file(file_name)), "")
    elif option == "0":
        return False

    else:
        raise KeyError("There is no such option.")
    return True
예제 #25
0
파일: contact.py 프로젝트: dferrer/Pool
 def DestroyBalls(self, world):
     for ball in self.to_destroy:
         # world.DestroyBody(ball)
         remove(ball)
     self.to_destroy = []