def validate_sales_metrics_general_slots()

in functions/source/bot_fulfillment/bot_fulfillment.py [0:0]


def validate_sales_metrics_general_slots(content, is_valid, slots, year):
    if slots['year'] is not None and slots['orders_revenue'] is None and slots['revenue_type'] is None:
        is_valid = False
        content = "I couldn't understand what you mean. Type \"Help\" to know about the areas that I can converse on."
    elif slots['year'] is not None and int(slots['year'].split('-')[0]) != int(year):
        is_valid = False
        slots['current_year'] = year
        content = "Oops! I have only current year data with me. Please ask for a metric on current year."
    elif slots['revenue_type'] is None:
        is_valid = False
        content = " I am having trouble understanding what you mean. I have data only on <b>overall or average</b> revenue and orders."
    elif slots['revenue_type'] is not None and (
            len(set(get_splited_revenue_type(slots)).intersection(average_revenue_type)) == 0 and len(
            set(get_splited_revenue_type(slots)).intersection(overall_revenue_type)) == 0):
        is_valid = False
        content = "Oops! I can't answer that. At present, I have data only on <b>overall or average</b> revenue and orders."
    elif slots['revenue_type'] is not None and slots['revenue_type'] in invalid_revenue_type:
        is_valid = False
        content = "Oops! I can't answer that. At present, I have data only on <b>overall or average</b> revenue and orders."
    elif slots['orders_revenue'] is None:
        is_valid = False
        content = "I am having trouble understanding what you mean. I have data only on <b>revenue or orders</b>."
    elif slots['orders_revenue'] is not None and slots['orders_revenue'] not in orders_revenue:
        is_valid = False
        content = "Oops! I can't answer that. At present, I have data only on <b>revenue or orders</b>."

    return content, is_valid