Skip to content

Commit

Permalink
feat: Añadido campo tipo a resultado postprocesado
Browse files Browse the repository at this point in the history
  • Loading branch information
dangalmar committed Dec 14, 2023
1 parent af0555d commit 140c43a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion decide/postproc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def post(self, request):

postproc.do(opts, total_seats)

results = {"type_postproc": postproc.type, "results": postproc.results}

if not postproc.results:
return Response({}, status=400)
else:
return Response(postproc.results)
return Response(results)
5 changes: 3 additions & 2 deletions decide/voting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def do_postproc(self):

total_seats = self.seats

data = {'type': 'IDENTITY', 'options': opts, 'voting_id': self.id,
data = {'options': opts, 'voting_id': self.id,
'question_id': self.question.id, 'total_seats': self.seats, 'type': self.postproc_type}

response = mods.post('postproc', json=data)
Expand All @@ -242,5 +242,6 @@ def __str__(self):

def save(self, *args, **kwargs):
if self.voting_type != 'S' and self.postproc_type != 'NON':
raise ValidationError("Las técnicas de postprocesado no se pueden aplicar a votaciones no Simples")
raise ValidationError(
"Las técnicas de postprocesado no se pueden aplicar a votaciones no Simples")
super().save(*args, **kwargs)

0 comments on commit 140c43a

Please sign in to comment.