Commit 1f016f1f authored by Hiro's avatar Hiro 🏄
Browse files

Update stats update to add locale

parent 58c45eab
......@@ -208,7 +208,8 @@ class Sendmail(object):
)
yield self.conn.update_stats(
command="links", platform=platform, service="email"
command="links", platform=platform, language=locale,
service="email"
)
yield self.conn.update_request(
......
......@@ -83,17 +83,17 @@ class SQLite3(object):
query, (hid, status, id, service, date)
).addCallback(self.query_callback).addErrback(self.query_errback)
def update_stats(self, command, service, platform=None):
def update_stats(self, command, service, platform=None, language='en'):
"""
Update statistics to the database
"""
now_str = datetime.now().strftime("%Y%m%d")
query = "REPLACE INTO stats(num_requests, platform, "\
query = "REPLACE INTO stats(num_requests, platform, language, "\
"command, service, date) VALUES(COALESCE((SELECT num_requests FROM stats "\
"WHERE date=?)+1, 0), ?, ?, ?, ?) "\
"WHERE date=?)+1, 0), ?, ?, ?, ?, ?) "\
return self.dbpool.runQuery(
query, (now_str,platform, command, service, now_str)
query, (now_str, platform, language, command, service, now_str)
).addCallback(self.query_callback).addErrback(self.query_errback)
def get_links(self, platform, language, status):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment