[WEB - 490] chore: issue serializer changes (#3741)

* chore: issue serializer changes

* add assignee id check on the frontend

* add z-index for spreadsheet issue layout

---------

Co-authored-by: rahulramesha <rahulramesham@gmail.com>
This commit is contained in:
Bavisetti Narayan 2024-02-21 21:19:00 +05:30 committed by GitHub
parent b1592adc66
commit b1a5e4872b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 58 additions and 3 deletions

View File

@ -15,6 +15,10 @@ from django.db.models import (
Func, Func,
Prefetch, Prefetch,
) )
from django.contrib.postgres.aggregates import ArrayAgg
from django.contrib.postgres.fields import ArrayField
from django.db.models import Value, UUIDField
from django.db.models.functions import Coalesce
from django.utils import timezone from django.utils import timezone
# Third Party imports # Third Party imports
@ -130,7 +134,32 @@ def dashboard_assigned_issues(self, request, slug):
.annotate(count=Func(F("id"), function="Count")) .annotate(count=Func(F("id"), function="Count"))
.values("count") .values("count")
) )
.order_by("created_at") .annotate(
label_ids=Coalesce(
ArrayAgg(
"labels__id",
distinct=True,
filter=~Q(labels__id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
assignee_ids=Coalesce(
ArrayAgg(
"assignees__id",
distinct=True,
filter=~Q(assignees__id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
module_ids=Coalesce(
ArrayAgg(
"issue_module__module_id",
distinct=True,
filter=~Q(issue_module__module_id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
)
) )
# Priority Ordering # Priority Ordering
@ -259,6 +288,32 @@ def dashboard_created_issues(self, request, slug):
.annotate(count=Func(F("id"), function="Count")) .annotate(count=Func(F("id"), function="Count"))
.values("count") .values("count")
) )
.annotate(
label_ids=Coalesce(
ArrayAgg(
"labels__id",
distinct=True,
filter=~Q(labels__id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
assignee_ids=Coalesce(
ArrayAgg(
"assignees__id",
distinct=True,
filter=~Q(assignees__id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
module_ids=Coalesce(
ArrayAgg(
"issue_module__module_id",
distinct=True,
filter=~Q(issue_module__module_id__isnull=True),
),
Value([], output_field=ArrayField(UUIDField())),
),
)
.order_by("created_at") .order_by("created_at")
) )

View File

@ -179,7 +179,7 @@ export const CreatedUpcomingIssueListItem: React.FC<IssueListItemProps> = observ
: "-"} : "-"}
</div> </div>
<div className="text-xs flex justify-center"> <div className="text-xs flex justify-center">
{issue.assignee_ids.length > 0 ? ( {issue.assignee_ids && issue.assignee_ids?.length > 0 ? (
<AvatarGroup> <AvatarGroup>
{issue.assignee_ids?.map((assigneeId) => { {issue.assignee_ids?.map((assigneeId) => {
const userDetails = getUserDetails(assigneeId); const userDetails = getUserDetails(assigneeId);

View File

@ -188,7 +188,7 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
<> <>
<td <td
className={cn( className={cn(
"sticky group left-0 h-11 w-[28rem] flex items-center bg-custom-background-100 text-sm after:absolute border-r-[0.5px] border-custom-border-200", "sticky group left-0 h-11 w-[28rem] flex items-center bg-custom-background-100 text-sm after:absolute border-r-[0.5px] z-[1] border-custom-border-200",
{ {
"border-b-[0.5px]": peekIssue?.issueId !== issueDetail.id, "border-b-[0.5px]": peekIssue?.issueId !== issueDetail.id,
}, },