@@ -153,7 +153,8 @@ def user_project_ownership(ctx: OrganizationReportContext) -> None:
153153 for project_id , user_id in OrganizationMember .objects .filter (
154154 organization_id = ctx .organization .id , teams__projectteam__project__isnull = False
155155 ).values_list ("teams__projectteam__project_id" , "user_id" ):
156- ctx .project_ownership .setdefault (user_id , set ()).add (project_id )
156+ if user_id is not None :
157+ ctx .project_ownership .setdefault (user_id , set ()).add (project_id )
157158
158159
159160def project_key_errors (
@@ -236,7 +237,7 @@ def project_key_performance_issues(ctx: OrganizationReportContext, project: Proj
236237 # Pick the 50 top frequent performance issues last seen within a month with the highest event count from all time.
237238 # Then, we use this to join with snuba, hoping that the top 3 issue by volume counted in snuba would be within this list.
238239 # We do this to limit the number of group_ids snuba has to join with.
239- groups = Group .objects .filter (
240+ groups_qs = Group .objects .filter (
240241 project_id = project .id ,
241242 status = GroupStatus .UNRESOLVED ,
242243 last_seen__gte = ctx .end - timedelta (days = 30 ),
@@ -246,7 +247,7 @@ def project_key_performance_issues(ctx: OrganizationReportContext, project: Proj
246247 ).order_by ("-times_seen" )[:50 ]
247248
248249 # Django doesn't have a .limit function, and this will actually do its magic to use the LIMIT statement.
249- groups = list (groups )
250+ groups = list (groups_qs )
250251 group_id_to_group = {group .id : group for group in groups }
251252
252253 if len (group_id_to_group ) == 0 :
0 commit comments