-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(activity): Include all group activities #100881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,13 @@ | |
|
||
|
||
class ActivityManager(BaseManager["Activity"]): | ||
def get_activities_for_group(self, group: Group, num: int) -> Sequence[Activity]: | ||
def get_activities_for_group(self, group: Group) -> Sequence[Activity]: | ||
""" | ||
Returns a list of Activity objects for the given group, ordered by most recent first, | ||
with duplicate consecutive activities (by type, ident, user_id, and data) filtered out, | ||
except for notes which are always included. Also appends a synthetic FIRST_SEEN activity | ||
at the end, using the group's initial priority if available. | ||
""" | ||
activities = [] | ||
activity_qs = self.filter(group=group).order_by("-datetime") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has always done a full table scan. We may want to add a new index. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can get metrics on the query here: |
||
|
||
|
@@ -56,7 +62,7 @@ def get_activities_for_group(self, group: Group, num: int) -> Sequence[Activity] | |
prev_sig = None | ||
sig = None | ||
# we select excess so we can filter dupes | ||
for item in activity_qs[: num * 2]: | ||
for item in activity_qs: | ||
prev_sig = sig | ||
sig = (item.type, item.ident, item.user_id, item.data) | ||
|
||
Comment on lines
62
to
68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential bug: Removing the limit in
|
||
|
@@ -78,7 +84,7 @@ def get_activities_for_group(self, group: Group, num: int) -> Sequence[Activity] | |
) | ||
) | ||
|
||
return activities[:num] | ||
return activities | ||
|
||
def create_group_activity( | ||
self, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1169,6 +1169,9 @@ def create_group(project, create_open_period=True, **kwargs): | |
if "status" not in kwargs: | ||
kwargs["status"] = GroupStatus.UNRESOLVED | ||
kwargs["substatus"] = GroupSubStatus.NEW | ||
if "status" in kwargs: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an unrelated change but I always see an error when executing tests locally. |
||
if kwargs["status"] == GroupStatus.UNRESOLVED and "substatus" not in kwargs: | ||
kwargs["substatus"] = GroupSubStatus.NEW | ||
|
||
group = Group.objects.create(project=project, **kwargs) | ||
if create_open_period: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is called by (link to code search):