Example #1
0
def update(table, list, id_):
    """
    Updates specified record in the table. Ask users for new data.

    Args:
        table: list in which record should be updated
        id_ (str): id of a record to update

    Returns:
        table with updated record
    """

    while True:
        returnable_list = common.common_update(table, list, id_)

        for item in returnable_list:
            if id_ in item:
                comparable_list = item

        if (comparable_list[1]).isdigit() == False and \
            (comparable_list[2]).isdigit() and \
            (comparable_list[3]).isdigit() and \
            int((comparable_list[3])) > 0 and \
            int((comparable_list[3])) < 13 and \
            (comparable_list[4]).isdigit() and\
            int((comparable_list[4])) > 0 and \
            int((comparable_list[4])) < 32 and \
            (comparable_list[5]).isdigit() and \
            int((comparable_list[5])) < 3000 and \
                int((comparable_list[5])) > 0:
            return returnable_list
        else:
            ui.print_error_message("\nYou entered wrong inputs\n")
Example #2
0
def update(table, list, id_):
    while True:
        returnable_list = common.common_update(table, list, id_)

        for item in returnable_list:
            if id_ in item:
                comparable_list = item

        if (comparable_list[1]).isdigit() == False and (
                comparable_list[2]).isdigit():
            return returnable_list
        else:
            ui.print_error_message("\nYou entered wrong inputs\n")
Example #3
0
def update(table, list, id_):
    while True:
        returnable_list = common.common_update(table, list, id_)

        for item in returnable_list:
            if id_ in item:
                comparable_list = item

        if (comparable_list[1]).isdigit() and \
            (comparable_list[5]).isdigit() and \
            (comparable_list[4]) == "in" or (comparable_list[4]) == "out" and \
            int((comparable_list[1])) > 0 and \
            int((comparable_list[1])) < 13 and \
            (comparable_list[2]).isdigit() and \
            int((comparable_list[2])) > 0 and \
            int((comparable_list[2])) < 32 and \
            (comparable_list[3]).isdigit() and \
            int((comparable_list[3])) < 3000 and \
                int((comparable_list[3])) > 0:
            return returnable_list
        else:
            ui.print_error_message("\nYou entered wrong inputs\n")
def update(table, id_):
    module_headers = ["Month: ", "Day: ", "Year: ", "Type: ", "Amount: "]
    return common.common_update(table, id_, "accounting/items.csv", module_headers)
def update(table, id_):
    module_headers = [
        "Name: ", "Manufacturer: ", "Purchase date: ", "Durability: "
    ]
    return common.common_update(table, id_, "inventory/inventory.csv",
                                module_headers)
Example #6
0
def update(table, id_):
    module_headers = ["Title: ", "Manufacturer: ", "Price: ", "In stock: "]
    return common.common_update(table, id_, "inventory/inventory.csv",
                                module_headers)
Example #7
0
def update(table, id_):
    module_headers = ["Name: ", "Birth date: "]
    return common.common_update(table, id_, "hr/persons.csv", module_headers)
Example #8
0
def update(table, id_):
    module_headers = ["Name: ", "E-mail: ", "Subscribed: "]
    return common.common_update(table, id_, "crm/customers.csv",
                                module_headers)
def update(table, id_):
    module_headers = ["Title: ", "Price: ", "Month: ", "Day: ", "Year: ", "Customer ID: "]
    return common.common_update(table, id_, "sales/sales.csv", module_headers)