fix: export for analytics and csv (#5815)
This commit is contained in:
parent
cf53cdf6ba
commit
701af734cd
2 changed files with 30 additions and 3 deletions
|
|
@ -10,6 +10,9 @@ from celery import shared_task
|
|||
from django.core.mail import EmailMultiAlternatives, get_connection
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.html import strip_tags
|
||||
from django.db.models import Q, Case, Value, When
|
||||
from django.db import models
|
||||
from django.db.models.functions import Concat
|
||||
|
||||
# Module imports
|
||||
from plane.db.models import Issue
|
||||
|
|
@ -84,7 +87,32 @@ def get_assignee_details(slug, filters):
|
|||
"""Fetch assignee details if required."""
|
||||
return (
|
||||
Issue.issue_objects.filter(
|
||||
workspace__slug=slug, **filters, assignees__avatar__isnull=False
|
||||
Q(
|
||||
Q(assignees__avatar__isnull=False)
|
||||
| Q(assignees__avatar_asset__isnull=False)
|
||||
),
|
||||
workspace__slug=slug,
|
||||
**filters,
|
||||
)
|
||||
.annotate(
|
||||
assignees__avatar_url=Case(
|
||||
# If `avatar_asset` exists, use it to generate the asset URL
|
||||
When(
|
||||
assignees__avatar_asset__isnull=False,
|
||||
then=Concat(
|
||||
Value("/api/assets/v2/static/"),
|
||||
"assignees__avatar_asset", # Assuming avatar_asset has an id or relevant field
|
||||
Value("/"),
|
||||
),
|
||||
),
|
||||
# If `avatar_asset` is None, fall back to using `avatar` field directly
|
||||
When(
|
||||
assignees__avatar_asset__isnull=True,
|
||||
then="assignees__avatar",
|
||||
),
|
||||
default=Value(None),
|
||||
output_field=models.CharField(),
|
||||
)
|
||||
)
|
||||
.distinct("assignees__id")
|
||||
.order_by("assignees__id")
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ def upload_to_s3(zip_file, workspace_id, token_id, slug):
|
|||
ExpiresIn=expires_in,
|
||||
)
|
||||
else:
|
||||
|
||||
# If endpoint url is present, use it
|
||||
if settings.AWS_S3_ENDPOINT_URL:
|
||||
s3 = boto3.client(
|
||||
|
|
@ -129,7 +128,7 @@ def upload_to_s3(zip_file, workspace_id, token_id, slug):
|
|||
zip_file,
|
||||
settings.AWS_STORAGE_BUCKET_NAME,
|
||||
file_name,
|
||||
ExtraArgs={"ACL": "public-read", "ContentType": "application/zip"},
|
||||
ExtraArgs={"ContentType": "application/zip"},
|
||||
)
|
||||
|
||||
# Generate presigned url for the uploaded file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue