Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,16 @@ def populate_all(

messages = request_all(client, request)

topic_count = len(messages)
last_message = messages[-1]
latest_date = last_message["timestamp"]
if messages:
# Dump empty topics but don't try to get the latest message or
# date from them
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the logic behind the approach here? Empty topics are the "general chat" feature.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By empty I mean "does not contain messages". Our chat has a general chat that seems to contain messages on the application but messages[-1] raises an exception. So I figured we would not update the dates from non-existent messages.

Are you expecting to see no messages in "general chat"?

topic_count = len(messages)
last_message = messages[-1]
latest_date = last_message["timestamp"]

topic_data[topic_name] = dict(size=topic_count, latest_date=latest_date)
topic_data[topic_name] = dict(size=topic_count, latest_date=latest_date)

latest_id = max(latest_id, last_message["id"])
latest_id = max(latest_id, last_message["id"])

dump_topic_messages(json_root, s, topic_name, messages)

Expand Down