def get_core_rule(self):
        def _div49_comp_rule(row):
            if row['min_comp_MM'] is not None:
                return 0.99 * row['min_comp_MM']

        div49_comp_rule = Working_func(_div49_comp_rule, '0.99 min_comp_MM')

        return [div49_comp_rule]
Exemple #2
0
    def get_post_rule(self):
        common_rule_lst = [post_rule.round_to_96, post_rule.reg_bound_d_flag]

        return [
            Working_func(
                partial(post_rule.post_rule_chain,
                        func_lst=[post_rule.DP_RECM_price] + common_rule_lst))
        ]
 def get_post_rule(self):
     common_rule_lst = [
         post_rule.round_to_96,
         post_rule.check_mkpl,
         post_rule.min_margin_lb,
         post_rule.uplift_to_MAP_when_below,
         post_rule.map_lower_bound,
         post_rule.reg_bound_d_flag]
     return [
         Working_func(partial(post_rule.post_rule_chain,
                              func_lst=[post_rule.DP_RECM_price] + common_rule_lst))
     ]
    def get_deal_flag_rule(self):
        def _ee_deal_flag_rule(row):
            if row['post_rule_value'] is not None:
                if (row['post_rule_value'] - row['cost_with_subsidy']
                    ) / row['post_rule_value'] < 0.1:
                    return 'Y', 'EE Deal Flag 2'
                else:
                    return 'N', 'EE Deal Flag 1'

        ee_deal_flag_rule = Working_func(_ee_deal_flag_rule,
                                         'ee deal flag rule')

        return [ee_deal_flag_rule]
    def get_core_rule(self):

        def _div52_PMI_rule(row):
            if row['PMI'] is not None:
                if 1 - row['cost_with_subsidy']/row['PMI'] >= 0.25:
                    return row['PMI'] * 0.99, '0.99 PMI'
                else:
                    return row['PMI'], 'PMI'

        div52_PMI_rule = Working_func(_div52_PMI_rule, 'Div52 PMI rule')

        return [
            core_rule.Match_to_Min_comp_MM,
            core_rule.VD_delete
        ]
    def get_core_rule(self):
        def _ce_rule(row):
            if row['tools_min_price'] is not None and row[
                    'min_comp_MM'] is not None:
                return row['min_comp_MM'] * (
                    1 + row['tools_min_price']), 'Set to min_comp_MM'
            elif row['PMI'] is not None and row['tools_pmi_price'] is not None:
                return row['PMI'] * (
                    1 + row['tools_pmi_price']), 'Set to PMI price'
            elif row['tools_pmi_price'] is not None and row['reg'] is not None:
                return row['reg'] * (
                    1 + row['tools_pmi_price']), 'Set to Reg price'

        ce_rule = Working_func(_ce_rule, 'CE special rules with multiplier')
        return [ce_rule]
    def get_post_rule(self):
        common_rule_lst = [
            post_rule.round_to_96, post_rule.map_lower_bound,
            post_rule.reg_bound_d_flag
        ]

        return [
            # Working_func(partial(post_rule.post_rule_chain,
            #                      func_lst=[post_rule.VD_Increase_PMI_to_min_margin] + common_rule_lst
            #                      )),
            # Working_func(partial(post_rule.post_rule_chain,
            #                      func_lst=[post_rule.Min_PMI_DP_D_flag] + common_rule_lst)),
            Working_func(
                partial(post_rule.post_rule_chain,
                        func_lst=[post_rule.DP_RECM_price] + common_rule_lst))
        ]
    def get_pre_rule(self):
        def mattress_itm_filter(row):
            if row['itm_no'] not in (17335,
17332,
17334,
17333,
17330,
17331,
17329,
17326,
17328,
17327,
17420,
17421,
17324,
17325,
15268,
15265,
15267,
15264,
17395,
17401,
17392,
17398,
17394,
17400,
17393,
17399,
17431,
17432,
17390,
17396,
17391,
17397,
18944,
18940,
18941,
18943,
18942,
18938,
18939,
15280,
15277,
15279,
15278,
15282,
15275,
15276,
15274,
15271,
15273,
15272,
15281,
15269,
15270,
17341,
17347,
17338,
17344,
17340,
17346,
17339,
17345,
17422,
17423,
17336,
17342,
17337,
17343,):
                return False
        return [
            Working_func(mattress_itm_filter, desc='Not in Mattress item list'),
            pre_rule.ad_plan_check,
            pre_rule.dp_block,
            pre_rule.apparel_brand_check,
            pre_rule.cost_check,
            pre_rule.pmi_check,
            pre_rule.reg_check
        ]
 def get_uplift_rule(self):
     func_handle = partial(uplift_rule._uplift_by_percentage_max, uplift=1.035)
     return [
         Working_func(func_handle, 'Mattress 3.5% uplift')
     ]
 def get_uplift_rule(self):
     func_handle = partial(uplift_rule._uplift_by_percentage_max_no_free_shipping, uplift=1.07, max_val=5.0)
     return [
         Working_func(func_handle, '7% Uplift Max 5')
     ]