Argus icon indicating copy to clipboard operation
Argus copied to clipboard

Annotate incident list with user group info on related acks

Open podliashanyk opened this issue 7 months ago • 0 comments

As suggested by @lunkwill42 in #838:

But I guess the bigger question here is whether you will be calling this method repeatedly for a bunch of incidents in a table - that will be very inefficient.

That's when you might consider some sort of addition to IncidentQuerySet that pre-annotates the resulting Incident objects with acks-by-group from a single query.

Originally posted by @lunkwill42 in https://github.com/Uninett/Argus/pull/838#discussion_r1658433643

I'm sure @hmpf is much more on top of this than me, but besides looking at the Django docs, I believe this gives a nice overview: https://medium.com/@singhgautam7/django-annotations-steroids-to-your-querysets-766231f0823a

Originally posted by @lunkwill42 in https://github.com/Uninett/Argus/pull/838#discussion_r1658439274

Alternative suggestion was to add a new property in incident. By @elfjes in #838:

another option could be to have a property, say Incident.ack_groups that returns a set[str] with non-expired ack-groupnames. You could then do a simple in/__contains__ check if you want to check against a specific group. Still best to prefetch the acks though

Originally posted by @elfjes in https://github.com/Uninett/Argus/pull/838#discussion_r1661105012

podliashanyk avatar Jul 05 '24 12:07 podliashanyk