Skip to content

Commit

Permalink
appease linter
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin committed Dec 4, 2024
1 parent 7748d09 commit 7d36580
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion posthog/api/error_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def safely_get_queryset(self, queryset):
@action(methods=["POST"], detail=True)
def merge(self, request, **kwargs):
issue: ErrorTrackingIssue = self.get_object()
ids: list[list[str]] = request.data.get("ids", [])
ids: list[str] = request.data.get("ids", [])
issue.merge(issue_ids=ids)
return Response({"success": True})

Expand Down
10 changes: 5 additions & 5 deletions posthog/models/error_tracking/error_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,12 @@ class Meta:
constraints = [models.UniqueConstraint(fields=["team", "fingerprint"], name="unique fingerprint for team")]


def resolve_fingerprints_for_issue(team_id: str, issue_id: str) -> list[str]:
def resolve_fingerprints_for_issue(team_id: int, issue_id: str) -> list[str]:
override_records = ErrorTrackingIssueFingerprintV2.objects.filter(team_id=team_id, issue_id=issue_id)
return [r.fingerprint for r in override_records]


def update_error_tracking_issue_fingerprint(
team_id: str, issue_id: str, fingerprint: list[str]
) -> tuple[str, int, str]:
def update_error_tracking_issue_fingerprint(team_id: int, issue_id: str, fingerprint: str) -> tuple[str, int, str]:
issue_fingerprint = ErrorTrackingIssueFingerprintV2.objects.select_for_update().get(
team_id=team_id, fingerprint=fingerprint
)
Expand All @@ -179,7 +177,9 @@ def update_error_tracking_issue_fingerprint(
return (fingerprint, issue_fingerprint.version, issue_id)


def update_error_tracking_issue_fingerprint_overrides(team_id: str, override_inserts: tuple[str, int, str]) -> None:
def update_error_tracking_issue_fingerprint_overrides(
team_id: int, override_inserts: list[tuple[str, int, str]]
) -> None:
for fingerprint, version, issue_id in override_inserts:
override_error_tracking_issue_fingerprint(
team_id=team_id, fingerprint=fingerprint, issue_id=issue_id, version=version
Expand Down
4 changes: 4 additions & 0 deletions posthog/models/error_tracking/test/test_error_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def test_basic_merge(self):
assert ErrorTrackingIssueFingerprintV2.objects.filter(issue_id=issue_two.id).count() == 2
# bumps the version
override = ErrorTrackingIssueFingerprintV2.objects.filter(fingerprint="fingerprint_one").first()
assert override
assert override.version == 1

# deletes issue one
Expand All @@ -45,8 +46,10 @@ def test_merge_multiple_times(self):

# bumps versions of the merged issues correct number of times
override = ErrorTrackingIssueFingerprintV2.objects.filter(fingerprint="fingerprint_one").first()
assert override
assert override.version == 2
override = ErrorTrackingIssueFingerprintV2.objects.filter(fingerprint="fingerprint_two").first()
assert override
assert override.version == 1

def test_merging_multiple_issues_at_once(self):
Expand All @@ -68,5 +71,6 @@ def test_splitting_fingerprints(self):

# bumps the version but no longer points to the old issue
override = ErrorTrackingIssueFingerprintV2.objects.filter(fingerprint="fingerprint_one").first()
assert override
assert override.issue_id != issue.id
assert override.version == 1

0 comments on commit 7d36580

Please sign in to comment.