mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
analytics: Text-wrap long lines exceeding 110.
License: Apache-2.0 Signed-off-by: rht <rhtbot@protonmail.com>
This commit is contained in:
@@ -177,7 +177,8 @@ def do_aggregate_to_summary_table(stat, end_time):
|
|||||||
start = time.time()
|
start = time.time()
|
||||||
cursor.execute(realmcount_query, {'end_time': end_time})
|
cursor.execute(realmcount_query, {'end_time': end_time})
|
||||||
end = time.time()
|
end = time.time()
|
||||||
logger.info("%s RealmCount aggregation (%dms/%sr)" % (stat.property, (end-start)*1000, cursor.rowcount))
|
logger.info("%s RealmCount aggregation (%dms/%sr)" % (
|
||||||
|
stat.property, (end - start) * 1000, cursor.rowcount))
|
||||||
|
|
||||||
# Aggregate into InstallationCount
|
# Aggregate into InstallationCount
|
||||||
installationcount_query = """
|
installationcount_query = """
|
||||||
@@ -194,7 +195,8 @@ def do_aggregate_to_summary_table(stat, end_time):
|
|||||||
start = time.time()
|
start = time.time()
|
||||||
cursor.execute(installationcount_query, {'end_time': end_time})
|
cursor.execute(installationcount_query, {'end_time': end_time})
|
||||||
end = time.time()
|
end = time.time()
|
||||||
logger.info("%s InstallationCount aggregation (%dms/%sr)" % (stat.property, (end-start)*1000, cursor.rowcount))
|
logger.info("%s InstallationCount aggregation (%dms/%sr)" % (
|
||||||
|
stat.property, (end - start) * 1000, cursor.rowcount))
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
## Utility functions called from outside counts.py ##
|
## Utility functions called from outside counts.py ##
|
||||||
@@ -294,7 +296,8 @@ count_message_by_user_query = """
|
|||||||
INSERT INTO analytics_usercount
|
INSERT INTO analytics_usercount
|
||||||
(user_id, realm_id, value, property, subgroup, end_time)
|
(user_id, realm_id, value, property, subgroup, end_time)
|
||||||
SELECT
|
SELECT
|
||||||
zerver_userprofile.id, zerver_userprofile.realm_id, count(*), '%(property)s', %(subgroup)s, %%(time_end)s
|
zerver_userprofile.id, zerver_userprofile.realm_id, count(*),
|
||||||
|
'%(property)s', %(subgroup)s, %%(time_end)s
|
||||||
FROM zerver_userprofile
|
FROM zerver_userprofile
|
||||||
JOIN zerver_message
|
JOIN zerver_message
|
||||||
ON
|
ON
|
||||||
@@ -336,7 +339,9 @@ count_message_type_by_user_query = """
|
|||||||
LEFT JOIN zerver_stream
|
LEFT JOIN zerver_stream
|
||||||
ON
|
ON
|
||||||
zerver_recipient.type_id = zerver_stream.id
|
zerver_recipient.type_id = zerver_stream.id
|
||||||
GROUP BY zerver_userprofile.realm_id, zerver_userprofile.id, zerver_recipient.type, zerver_stream.invite_only
|
GROUP BY
|
||||||
|
zerver_userprofile.realm_id, zerver_userprofile.id,
|
||||||
|
zerver_recipient.type, zerver_stream.invite_only
|
||||||
) AS subquery
|
) AS subquery
|
||||||
GROUP BY realm_id, id, message_type
|
GROUP BY realm_id, id, message_type
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ class Command(BaseCommand):
|
|||||||
continue
|
continue
|
||||||
print("%25s" % (stream.name,), end=' ')
|
print("%25s" % (stream.name,), end=' ')
|
||||||
recipient = Recipient.objects.filter(type=Recipient.STREAM, type_id=stream.id)
|
recipient = Recipient.objects.filter(type=Recipient.STREAM, type_id=stream.id)
|
||||||
print("%10d" % (len(Subscription.objects.filter(recipient=recipient, active=True)),), end=' ')
|
print("%10d" % (len(Subscription.objects.filter(recipient=recipient,
|
||||||
|
active=True)),), end=' ')
|
||||||
num_messages = len(Message.objects.filter(recipient=recipient))
|
num_messages = len(Message.objects.filter(recipient=recipient))
|
||||||
print("%12d" % (num_messages,))
|
print("%12d" % (num_messages,))
|
||||||
print("%d invite-only streams" % (invite_only_count,))
|
print("%d invite-only streams" % (invite_only_count,))
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ class Command(BaseCommand):
|
|||||||
# type: (ArgumentParser) -> None
|
# type: (ArgumentParser) -> None
|
||||||
parser.add_argument('--time', '-t',
|
parser.add_argument('--time', '-t',
|
||||||
type=str,
|
type=str,
|
||||||
help='Update stat tables from current state to --time. Defaults to the current time.',
|
help='Update stat tables from current state to'
|
||||||
|
'--time. Defaults to the current time.',
|
||||||
default=timezone_now().isoformat())
|
default=timezone_now().isoformat())
|
||||||
parser.add_argument('--utc',
|
parser.add_argument('--utc',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|||||||
@@ -105,4 +105,5 @@ class StreamCount(BaseCount):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
# type: () -> Text
|
# type: () -> Text
|
||||||
return "<StreamCount: %s %s %s %s %s>" % (self.stream, self.property, self.subgroup, self.value, self.id)
|
return "<StreamCount: %s %s %s %s %s>" % (
|
||||||
|
self.stream, self.property, self.subgroup, self.value, self.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user