Skip to content

Commit

Permalink
Fix: #50 Data disclosure agreement issues
Browse files Browse the repository at this point in the history
  • Loading branch information
albinpa authored and georgepadayatti committed Apr 5, 2024
1 parent dd851a2 commit fe8335d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion data_disclosure_agreement/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class Meta:
class DataDisclosureAgreementSerializer(serializers.ModelSerializer):
class Meta:
model = DataDisclosureAgreement
fields = ['dataDisclosureAgreementRecord']
fields = ['dataDisclosureAgreementRecord','status','isLatestVersion']
11 changes: 8 additions & 3 deletions data_disclosure_agreement/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ def get(self, request, dataDisclosureAgreementId):
serializer = self.serializer_class(
data_disclosure_agreement, context={"request": request}
)
dda = serializer.data["dataDisclosureAgreementRecord"]
dda['status'] = serializer.data['status']
dda['isLatestVersion'] = serializer.data['isLatestVersion']
response_data = {
"dataDisclosureAgreement": serializer.data["dataDisclosureAgreementRecord"],
"dataDisclosureAgreement": dda,
}

return JsonResponse(response_data)

def delete(self, request, dataDisclosureAgreementId):
Expand Down Expand Up @@ -116,8 +120,9 @@ def get(self, request):
temp_dda = dda["dataDisclosureAgreementRecord"]
else:
revisions.append(dda["dataDisclosureAgreementRecord"])
temp_dda["revisions"] = revisions
ddas.append(temp_dda)
if temp_dda:
temp_dda["revisions"] = revisions
ddas.append(temp_dda)
else:
temp_dda = {}
for dda_template_id in data_disclosure_agreements_template_ids:
Expand Down
15 changes: 10 additions & 5 deletions service/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get(self, request):
data_sources = DataSource.objects.filter(pk=dataSourceId_param)
else:
data_sources = DataSource.objects.all()

data_sources, pagination_data = paginate_queryset(data_sources, request)
serialized_data_sources = []
for data_source in data_sources:
Expand All @@ -84,11 +84,16 @@ def get(self, request):
data_disclosure_agreement_serializer = (
DataDisclosureAgreementsSerializer(dda_for_template_id)
)
ddas.append(
data_disclosure_agreement_serializer.data[
"dataDisclosureAgreementRecord"
dda = data_disclosure_agreement_serializer.data[
"dataDisclosureAgreementRecord"
]

if dda:
dda["status"] = data_disclosure_agreement_serializer.data["status"]
dda["isLatestVersion"] = data_disclosure_agreement_serializer.data[
"isLatestVersion"
]
)
ddas.append(dda)

try:
verification = Verification.objects.get(dataSourceId=data_source)
Expand Down

0 comments on commit fe8335d

Please sign in to comment.