Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Exception raised when viewing an facility on embedded map POSTed to the API with a product type array #1903

Closed
jwalgran opened this issue Jun 14, 2022 · 0 comments
Assignees
Labels
+ bug Something isn't working task 47 Q2 2022 bugs, support, maintenance
Milestone

Comments

@jwalgran
Copy link
Contributor

Overview

Exception raised when viewing an facility on embedded map POSTed to the API with a product type array

Steps to Reproduce

{
"name":"1v1 Fight Gear",
"address": "5320 Tower Way, Sanford, 32773, Florida ",
"country":"us",
"product_type": ["api a", "api b"]
}
  • Browse http://localhost:6543/settings, selected the embed tab, and check the "100%" box to get the preview to display
  • In the embed iframe, view the details of the "1v1 Fight Gear" facility
  • Verify that an exception is raised

Demo

2022-06-14 10 00 20

ERROR:django.request:Internal Server Error: /api/facilities/US2022161SEBGD5/
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/viewsets.py", line 114, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch
    response = self.handle_exception(exc)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
    raise exc
  File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/local/src/api/views.py", line 1015, in retrieve
    queryset, context=context).data
  File "/usr/local/lib/python3.7/site-packages/rest_framework/serializers.py", line 562, in data
    ret = super().data
  File "/usr/local/lib/python3.7/site-packages/rest_framework/serializers.py", line 260, in data
    self._data = self.to_representation(self.instance)
  File "/usr/local/lib/python3.7/site-packages/rest_framework_gis/serializers.py", line 132, in to_representation
    feature["properties"] = self.get_properties(instance, fields)
  File "/usr/local/lib/python3.7/site-packages/rest_framework_gis/serializers.py", line 157, in get_properties
    representation = field.to_representation(value)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/fields.py", line 1905, in to_representation
    return method(value)
  File "/usr/local/src/api/serializers.py", line 1002, in get_contributor_fields
    return assign_contributor_field_values(list_item, fields)
  File "/usr/local/src/api/serializers.py", line 730, in assign_contributor_field_values
    list_item, contributor_fields
  File "/usr/local/src/api/helpers.py", line 62, in get_single_contributor_field_values
    f['value'] = try_parse_int_from_float(value)
  File "/usr/local/src/api/helpers.py", line 52, in try_parse_int_from_float
    return str(int(float(value)))
TypeError: float() argument must be a string or a number, not 'list'
@jwalgran jwalgran added bug Something isn't working + task 004 Enable contributors to embed a map displaying only the facilities with which they are associated in labels Jun 14, 2022
@jwalgran jwalgran self-assigned this Jun 14, 2022
@obrienad obrienad added the task 47 Q2 2022 bugs, support, maintenance label Jun 14, 2022
@jwalgran jwalgran removed the task 004 Enable contributors to embed a map displaying only the facilities with which they are associated in label Jun 14, 2022
@obrienad obrienad added this to the Q2 2022 milestone Jul 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
+ bug Something isn't working task 47 Q2 2022 bugs, support, maintenance
Projects
None yet
Development

No branches or pull requests

2 participants