Пример #1
0
    def handle(self):
        user_service = self.get_container()['user_service']
        reader = CsvReader.get_reader(self.option('path'))

        progress = self.progress_bar()
        for row in reader:
            if not row['id'].isnumeric():
                progress.advance()
                continue

            social = [
                row[s]
                for s in ['facebook', 'google-oauth2', 'linkedin-oauth2']
                if row[s]
            ]

            user_service.insert([
                int(row['id']), row['email'], row['country'], row['industry'],
                row['website'], ', '.join(social),
                datetime.strptime(
                    row['date_joined'],
                    '%Y-%m-%d %H:%M:%S').date().strftime('%Y-%m-%d'),
                row['first_name'], row['last_name']
            ])
            progress.advance()

        progress.finish()
        self.line("\nDone!")
Пример #2
0
    def handle(self):
        path = self.option('path')

        payment_service = self.get_container()['payment_service']
        data = CsvReader.get_reader(path)

        progress = self.progress_bar()
        for row in data:
            payment_service.insert(list(row.values()))
            progress.advance()

        progress.finish()
        self.line("\nDone!")
Пример #3
0
    def handle(self):
        user_service = self.get_container()['user_service']
        reader = CsvReader.get_reader(self.option('path'))

        progress = self.progress_bar()
        for row in reader:
            if not row['user_id'].isnumeric():
                progress.advance()
                continue

            user_service.update_ip(int(row['user_id']), row['ip'])
            progress.advance()

        progress.finish()
        self.line("\nDone!")
Пример #4
0
    def handle(self):
        user_service = self.get_container()['user_service']
        reader = CsvReader.get_reader(self.option('path'))

        progress = self.progress_bar()
        progress.set_redraw_frequency(100)
        for row in reader:
            if not row['id'].isnumeric():
                progress.advance()
                continue

            user_service.update_fullname(int(row['id']), row['first_name'],
                                         row['last_name'])
            progress.advance()

        progress.finish()
        self.line("\nDone!")
Пример #5
0
    def handle(self):
        user_service = self.get_container()['user_service']
        reader = CsvReader.get_reader(self.option('path'))

        traffic_source = 'Paid Search'
        search_pattern = 'utm_source=google_as'
        progress = self.progress_bar()
        for row in reader:
            if not row['user_id'].isnumeric() or row['url'].find(
                    search_pattern) == -1:
                progress.advance()
                continue

            user_service.update_traffic_source(int(row['user_id']),
                                               traffic_source)
            progress.advance()

        progress.finish()
        self.line("\nDone!")
    def handle(self):
        user_service = self.get_container()['user_service']
        reader = CsvReader.get_reader(self.option('path'))

        progress = self.progress_bar()
        progress.set_redraw_frequency(100)
        for row in reader:
            if not row['user_id'].isnumeric():
                progress.advance()
                continue

            user_service.update_email_confirm_and_provider(
                int(row['user_id']),
                1 if row['email_confirmed'] == 'True' else 0,
                row['provider'] if row['provider'] != '' else 'email')
            progress.advance()

        progress.finish()
        self.line("\nDone!")