Skip to content

Commit

Permalink
Forgo evil evil serializer (#4434)
Browse files Browse the repository at this point in the history
* Forgo evil evil serializer

* Remove parsed results
  • Loading branch information
haneslinger authored Dec 6, 2023
1 parent d06600e commit ae98297
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions seed/views/v3/analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
PropertyView
)
from seed.serializers.analyses import AnalysisSerializer
from seed.serializers.analysis_property_views import (
AnalysisPropertyViewSerializer
)
from seed.utils.api import OrgMixin, api_endpoint_class
from seed.utils.api_schema import AutoSchemaHelper

Expand Down Expand Up @@ -159,7 +156,25 @@ def list(self, request):
views_queryset = views_queryset.annotate(display_name=F(f'property_state__{display_column_field}')).prefetch_related("analysisoutputfile_set")
property_views_by_apv_id = AnalysisPropertyView.get_property_views(views_queryset)

results["views"] = AnalysisPropertyViewSerializer(list(views_queryset), many=True).data
results["views"] = [
{
"id": view.id,
"display_name": view.display_name,
"analysis": view.analysis_id,
"property": view.property_id,
"cycle": view.cycle_id,
"property_state": view.property_state_id,
"output_files": [
{
"id": output_file.id,
"content_type": output_file.content_type,
"file": output_file.file.path
}
for output_file in view.analysisoutputfile_set.all()
],
}
for view in views_queryset
]
results["original_views"] = {
apv_id: property_view.id if property_view is not None else None
for apv_id, property_view in property_views_by_apv_id.items()
Expand Down

1 comment on commit ae98297

@ebeers-png
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing this commit message made me laugh a lot this morning, thank you 😂

Please sign in to comment.