From eb930123454771b80465505579d723c92b3dd84c Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 16 Jun 2016 23:32:24 +0300 Subject: refactoring & support more user fields And a bunch of other minor improvements. --- vk/utils/tracking/db/writer/csv.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'vk/utils/tracking/db/writer') diff --git a/vk/utils/tracking/db/writer/csv.py b/vk/utils/tracking/db/writer/csv.py index 8dc2299..8c635b4 100644 --- a/vk/utils/tracking/db/writer/csv.py +++ b/vk/utils/tracking/db/writer/csv.py @@ -36,8 +36,12 @@ class Writer: def write_record(self, user): if not self: return - self._write_row(Record.from_user(user).to_row()) + self._write_row(self._record_to_row(Record.from_user(user))) self.flush() def _write_row(self, row): self._writer.writerow(row) + + @staticmethod + def _record_to_row(record): + return [str(record.get_timestamp())] + [str(record[field]) for field in record] -- cgit v1.2.3