Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Cecylia Bocovich
gettor
Commits
1f016f1f
Commit
1f016f1f
authored
May 23, 2019
by
Hiro
🏄
Browse files
Update stats update to add locale
parent
58c45eab
Changes
2
Hide whitespace changes
Inline
Side-by-side
gettor/services/email/sendmail.py
View file @
1f016f1f
...
...
@@ -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
(
...
...
gettor/utils/db.py
View file @
1f016f1f
...
...
@@ -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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment