Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #364 from david-fisher/MergeSchemaFix1
Browse files Browse the repository at this point in the history
Merge schema fix1
  • Loading branch information
StephenMoynahanIV authored May 6, 2021
2 parents 6b05944 + 87e774b commit 0f0514c
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions moral_kombat_backend/lead/tables/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,34 +346,34 @@ class IssuesViewSet(viewsets.ModelViewSet):
# filter_backends = [DjangoFilterBackend]
# filterset_fields = ['scenario_id', "name"]

def create(self, request, *args, **kwargs):
# def create(self, request, *args, **kwargs):

serializer = IssuesSerializer(data=request.data)
# serializer = IssuesSerializer(data=request.data)

if serializer.is_valid():
# if serializer.is_valid():

serializer.save()
# serializer.save()

scenarioID = serializer.data['scenario_id']
issueID = serializer.data['issue']
# scenarioID = serializer.data['scenario_id']
# issueID = serializer.data['issue']

stakeholders = stakeholders.objects.filter(scenario=scenarioID).values()
# stakeholders = stakeholders.objects.filter(scenario=scenarioID).values()

for stakeholder in stakeholders:
newCoverage = {}
newCoverage['stakeholder'] = stakeholder['stakeholder']
newCoverage['issue'] = issueID
newCoverage['coverage_score'] = 0
# for stakeholder in stakeholders:
# newCoverage = {}
# newCoverage['stakeholder'] = stakeholder['stakeholder']
# newCoverage['issue'] = issueID
# newCoverage['coverage_score'] = 0

coverageSerial = coverageSerializer(data=newCoverage)
if coverageSerial.is_valid():
coverageSerial.save()
else:
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
# coverageSerial = coverageSerializer(data=newCoverage)
# if coverageSerial.is_valid():
# coverageSerial.save()
# else:
# return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

return Response(serializer.data, status=status.HTTP_201_CREATED)
# return Response(serializer.data, status=status.HTTP_201_CREATED)

return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
# return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)


class Action_pageViewSet(viewsets.ModelViewSet):
Expand Down

0 comments on commit 0f0514c

Please sign in to comment.