Skip to content

Commit

Permalink
Fixed #1153 - DES science portal object look up not working (#1154)
Browse files Browse the repository at this point in the history
* Fixed #1153 - DES science portal object look up not working

* Changed how the attribute type is checked #1153
  • Loading branch information
glaubervila authored Jun 24, 2019
1 parent d441104 commit 57353d6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions api/catalog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from .models import Rating, Reject, Comments
from .serializers import RatingSerializer, RejectSerializer, CommentsSerializer

import math


class RatingViewSet(viewsets.ModelViewSet):
"""
Expand Down Expand Up @@ -207,6 +209,16 @@ def list(self, request):
"_meta_comments": None
})

# FIXED Issue: https://github.com/linea-it/dri/issues/1153
# Ticket: http://ticket.linea.gov.br/ticket/11761
for prop in row:
if isinstance(row.get(prop, None), float):
# Check if is infity
if math.isinf(row.get(prop)):
if row.get(prop) > 0:
row.update({prop: "+Infinity"})
elif row.get(prop) < 0:
row.update({prop: "-Infinity"})


return Response(dict({
Expand Down

0 comments on commit 57353d6

Please sign in to comment.