Skip to content

fix: dedupe Telegram album posts in analytics report; repair test suite#462

Merged
alexeyqu merged 3 commits into
masterfrom
dev
Jul 4, 2026
Merged

fix: dedupe Telegram album posts in analytics report; repair test suite#462
alexeyqu merged 3 commits into
masterfrom
dev

Conversation

@alexeyqu

@alexeyqu alexeyqu commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix weekly Telegram analytics report (tg_analytics_report_job.py) counting each photo in a multi-image album post as a separate new post and multiplying its views by the album size (Telegram's broadcast stats API reports one entry per message, not per visual post).
  • Repair the unit test suite, which failed to even collect: conftest.py and several test files still referenced src.trello.trello_client/trello_objects, deleted during the earlier Trello->Planka migration, along with other stale fixtures/signatures (use_focalboard/use_planka kwargs, TrelloCard.to_dict(), idBoard key) that no longer exist.

Test plan

  • pytest tests/unit/ — 42 passed, 4 skipped, 2 xfailed (previously failed to collect)
  • Manual simulation of _deduplicate_albums confirms a 9-photo album + 2 singles collapses to 3 posts with correct summed views

alexeyqu and others added 3 commits July 4, 2026 16:53
Meta deprecated page_impressions_unique and page_impressions_organic_unique
(all API versions), which silently zeroed out reach in the weekly FB report.
Total reach now uses page_total_media_view_unique (true unique-reach
replacement); organic reach uses page_media_view broken down by is_from_ads
since Meta removed the organic unique-reach metric with no replacement.
Also adds get_weekly_paid_views for the same is_from_ads breakdown.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Telegram's broadcast stats API reports each photo in a gallery post as a
separate message with the same view count, which inflated new_posts_count
and recent_message_views by the album size (e.g. a 9-photo post counted as
9 new posts and 9x its views).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
conftest.py and several test files still imported the deleted
src.trello.trello_client/trello_objects modules and exercised APIs
(use_focalboard/use_planka kwargs, TrelloCard.to_dict(), idBoard key)
that no longer exist after the Planka migration, so the whole suite
failed to even collect. Removes the dead mock_trello fixture and
test_trello_client.py (which tested the deleted TrelloClient), updates
stale imports to src.planka.board_objects, and aligns test expectations
with current handler signatures and object field names.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@alexeyqu alexeyqu merged commit 80e666a into master Jul 4, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant