diff --git a/backend/app/services/post_association_service.py b/backend/app/services/post_association_service.py index 399713c..ddab64f 100644 --- a/backend/app/services/post_association_service.py +++ b/backend/app/services/post_association_service.py @@ -391,9 +391,10 @@ class PostAssociationService: auto_id = conclusive[0][0].id linked = 0 - for group, score, signals, identity in scored: + for group, score, signals, _identity in scored: status = "linked" if group.id == auto_id else "pending" - linked += status == "linked" + if status == "linked": + linked += 1 self.session.add(PostAssociation( announcement_post_id=announcement.id, payload_post_id=group.id, diff --git a/tests/test_post_association.py b/tests/test_post_association.py index 2535451..c7c6bed 100644 --- a/tests/test_post_association.py +++ b/tests/test_post_association.py @@ -306,7 +306,7 @@ async def test_a_dismissed_pair_is_never_proposed_again(db): svc = PostAssociationService(db) assert await svc.match_post( teaser.id, threshold=DEFAULT_THRESHOLD, window_hours=WINDOW, - ) == 1 + ) == (1, 0) await db.commit() assoc = (await db.execute(select(PostAssociation))).scalar_one()