jenkins-bot has submitted this change and it was merged.

Change subject: Fix a few timestamps in audit messages
......................................................................


Fix a few timestamps in audit messages

Round off source_enqueued_time, parse date and settled_date

Bug: T140667
Change-Id: Iba333c3e3d0817920406c2fca4a27032721f3f95
---
M audit/paypal/TrrFile.py
M audit/paypal/ppreport.py
M queue/redis_wrap.py
3 files changed, 8 insertions(+), 3 deletions(-)

Approvals:
  XenoRyet: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/audit/paypal/TrrFile.py b/audit/paypal/TrrFile.py
index b96984f..252d522 100644
--- a/audit/paypal/TrrFile.py
+++ b/audit/paypal/TrrFile.py
@@ -97,8 +97,8 @@
 
         out = {
             'gateway_txn_id': row['Transaction ID'],
-            'date': row['Transaction Initiation Date'],
-            'settled_date': row['Transaction Completion Date'],
+            'date': ppreport.parse_date(row['Transaction Initiation Date']),
+            'settled_date': ppreport.parse_date(row['Transaction Completion 
Date']),
             'gross': float(row['Gross Transaction Amount']) / 100.0,
             'currency': row['Gross Transaction Currency'],
             'gateway_status': row['Transactional Status'],
diff --git a/audit/paypal/ppreport.py b/audit/paypal/ppreport.py
index b18435a..26b27e9 100644
--- a/audit/paypal/ppreport.py
+++ b/audit/paypal/ppreport.py
@@ -1,3 +1,4 @@
+import dateutil.parser
 import io
 
 from failmail.mailer import FailMailer
@@ -47,3 +48,7 @@
                 pass
             else:
                 raise RuntimeError("Unknown column type: 
{type}".format(type=column_type))
+
+def parse_date(date_string):
+    date_object = dateutil.parser.parse(date_string)
+    return date_object.strftime('%s')
diff --git a/queue/redis_wrap.py b/queue/redis_wrap.py
index 38d4d5e..9897ad7 100644
--- a/queue/redis_wrap.py
+++ b/queue/redis_wrap.py
@@ -43,6 +43,6 @@
             'source_type': 'audit',
             'source_run_id': os.getpid(),
             'source_version': process.version_stamp.source_revision(),
-            'source_enqueued_time': time.time(),
+            'source_enqueued_time': int(time.time()),
             'source_host': socket.gethostname(),
         }

-- 
To view, visit https://gerrit.wikimedia.org/r/315529
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iba333c3e3d0817920406c2fca4a27032721f3f95
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to