Exemple #1
0
    def get_transactions(self, start_date, end_date):
        conversions = HasOffers.get_transactions(self, start_date, end_date)

        if len(conversions) > 0:
            # remove invalid rows from wrong sync
            conversions = conversions[conversions['ho:Stat.pixel_refer'] != 'invalid_conversion']

            # setting order id
            conversions['ipg:orderId'] = conversions.apply(
                lambda x: x['ipg:orderId'] if pandas.notnull(x['ipg:orderId']) and (
                        len(x['ipg:orderId'].strip()) != 0 and str(x['ipg:orderId']).strip() not in ['ORDER_ID',
                                                                                                     'undefined'])
                else pandas.np.nan, axis=1)

            # setting the affiliate to the original one before syncing
            conversions['ipg:sourceAffiliate'] = conversions['ipg:affiliateNetwork']
            conversions['ipg:affiliateNetwork'] = conversions.apply(
                lambda x: parse.detect_original_affiliate(x['ipg:source'],
                                                          x['ho:Stat.affiliate_info4'],
                                                          x['ho:Stat.affiliate_info5']) or x['ipg:affiliateNetwork'], axis=1)

            conversions = self.detect_test_orders(conversions)
            conversions = self.detect_duplicated_orders(conversions)

        return conversions
Exemple #2
0
    def get_transactions(self, start_date, end_date):
        # return empty resultset after Nov 30th 2017 as involveasia will be used
        if start_date > date(2017, 11, 30):
            return pandas.DataFrame()

        data = HasOffers.get_transactions(self, start_date, end_date)

        return data
Exemple #3
0
    def get_transactions(self, start_date, end_date):
        data = HasOffers.get_transactions(self, start_date, end_date)

        if len(data) > 0:
            data['ipg:orderValue'] = data.apply(lambda x: (float(x['ho:Stat.payout']) / 0.0641) if (
                'mobile app' in x['ho:Offer.name'].lower() and
                datetime.strptime(x['ho:Stat.datetime'], '%Y-%m-%d %H:%M:%S') <= datetime(2016, 5, 31)) else
                x['ho:Stat.sale_amount'], axis=1)

        return data