Skip to content

Commit

Permalink
feat: show progress in terms of tweets, not notes
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed May 16, 2024
1 parent f8131c9 commit f872dbd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
12 changes: 5 additions & 7 deletions output/about/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ Notes are excluded if they meet any of the following criteria:

We also attempt to filter out notes for deleted tweets and non-English tweets.

{% if site.data.meta.total_notes %}
{% if site.data.meta.total_tweets %}
---

#### Tweet indexing status

{% assign perc_fetched = site.data.meta.total_fetched | times: 100 | divided_by: site.data.meta.total_notes %}
{% assign perc_fetched = site.data.meta.total_fetched | times: 100 | divided_by: site.data.meta.total_tweets %}

<div class="progress my-2" style="max-width: 500px;" role="progressbar">
<div class="progress-bar text-bg-{% if perc_fetched == 100 %}success{% else %}warning{% endif %}" style="width: {{ perc_fetched }}%">{{ perc_fetched }}% ({{ site.data.meta.total_fetched }} / {{ site.data.meta.total_notes }})</div>
<div class="progress" style="max-width: 500px;" role="progressbar">
<div class="progress-bar text-bg-{% if perc_fetched == 100 %}success{% else %}warning{% endif %}" style="width: {{ perc_fetched }}%">{{ perc_fetched }}% ({{ site.data.meta.total_fetched }} / {{ site.data.meta.total_tweets }})</div>
</div>

{{ perc_fetched }}% of notes have an indexed tweet (or the tweet has been deleted).

This means the text of these tweets is searchable.
{{ perc_fetched }}% of tweets are searchable.

{% endif %}

Expand Down
4 changes: 2 additions & 2 deletions x_notes/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def update_meta_from_notes(notes: dict[str, dict[str, Any]]) -> None:
update = {
"scraped_at": datetime.now(timezone.utc).isoformat(),
"most_recent": list(notes.values())[0]["created_at"],
"total_notes": len(notes),
"total_fetched": len([1 for note in notes.values() if "dl" in note]),
"total_tweets": len({note["tweet_id"] for note in notes}),
"total_fetched": len({note["tweet_id"] for note in notes if "dl" in note}),
}
update_meta(update)
4 changes: 2 additions & 2 deletions x_notes/tweets.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ async def fetch_tweets() -> None:
update_meta(
{
"locked_until": locked_until,
"total_notes": len(notes),
"total_fetched": len([1 for note in notes.values() if "dl" in note]),
"total_tweets": len({note["tweet_id"] for note in notes}),
"total_fetched": len({note["tweet_id"] for note in notes if "dl" in note}),
}
)

Expand Down

0 comments on commit f872dbd

Please sign in to comment.