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 #359 from david-fisher/MergeSchemaFix1
Browse files Browse the repository at this point in the history
Merge schema fix1
  • Loading branch information
sdub18 authored May 6, 2021
2 parents 2e48ebb + 8c2d2a4 commit 550f9dc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export default function ICMatrix({ scenario_ID }) {
var config = {
method: 'put',
//url: baseURL + '/multi_stake?scenario=' + scenario_ID,
url: baseURL + '/multi_stake?scenario=' + scenario_ID,
//url: baseURL + '/multi_stake?scenario=' + scenario_ID,
url: baseURL + '/stakeholder',
headers: {
'Content-Type': 'application/json',
},
Expand Down
29 changes: 29 additions & 0 deletions moral_kombat_backend/lead/tables/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,35 @@ class IssuesViewSet(viewsets.ModelViewSet):
# filter_backends = [DjangoFilterBackend]
# filterset_fields = ['scenario_id', "name"]

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

serializer = IssuesSerializer(data=request.data)

if serializer.is_valid():

serializer.save()

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

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

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)

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

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


class Action_pageViewSet(viewsets.ModelViewSet):
queryset = action_page.objects.all()
Expand Down

0 comments on commit 550f9dc

Please sign in to comment.