def validate_sales_metrics_performing_slots()

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


def validate_sales_metrics_performing_slots(content, is_valid, slots, year):
    if slots['year'] is not None and slots['orders_revenue'] is None and slots['performance_type'] is None and slots[
        'product_salesteams'] 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['performance_type'] is None:
        is_valid = False
        content = "I am having trouble understanding what you mean. I have data only on <b>top</b> performing products or sales teams."
    elif slots['performance_type'] is not None and slots['performance_type'] not in performance_list:
        is_valid = False
        content = "Oops! I can't answer that. At present, I have data only on <b>top</b> performing products or sales teams."
    elif slots['product_salesteams'] is None:
        is_valid = False
        content = "I am having trouble understanding what you mean. I have data only on top performing <b>products or sales teams</b>."
    elif slots['product_salesteams'] is not None and slots['product_salesteams'] not in product_sales_list:
        is_valid = False
        content = "Oops! I can't answer that. At present, I have data only on top performing <b>products or sales teams</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 top performing products or sales teams by <b>revenue or orders</b>"
    elif slots['orders_revenue'] is None:
        slots['orders_revenue'] = 'revenue'
    return content, is_valid