match4everyone / match4healthcare

Helping hospitals find qualified medicine students (Hackathon #wirvsvirus). A more flexibel version is currently in development under match4everyone/match4everything,
https://match4healthcare.de
Other
17 stars 10 forks source link

Entering fractional distances in the supporter search screen causes Internal Server Error 500 #512

Closed maltezacharias closed 4 years ago

maltezacharias commented 4 years ago

Describe the bug Entering fractional distances in the supporter search screen causes Internal Server Error 500

To Reproduce Steps to reproduce the behavior:

  1. Go to find supporters screen with a facility user
  2. Enter a fractional distance (e.g. 6,5)
  3. Perform search

Expected behavior Either an error message or even better automatically rounding the distance to the nearest int

Screenshots/Logs

{
  "status_code": 500,
  "request": {
    "path": "/ineedstudent/students/DE/10557/10",
    "method": "GET",
    "get": {
      "countrycode": "**",
      "plz": "*****",
      "distance": "6,5",
      "ausbildung_typ_medstud": "true",
      "ausbildung_typ_medstud_abschnitt_x_gt": "*",
      "ausbildung_typ_medstud_abschnitt_x_lt": "*",
      "availability_start": "",
      "braucht_bezahlung": "1",
      "unterkunft_gewuenscht": "False"
    }
  },
  "level": "error",
  "message": "[django.request]: Internal Server Error: /ineedstudent/students/DE/*****/**",
  "timestamp": "2020-05-15T15:07:18.427352",
  "user": "**********",
  "exc_info": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.6/dist-packages/django/core/handlers/exception.py\", line 34, in inner\n    response = get_response(request)\n  File \"/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py\", line 115, in _get_response\n    response = self.process_exception_by_middleware(e, request)\n  File \"/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py\", line 113, in _get_response\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\n  File \"/usr/local/lib/python3.6/dist-packages/django/contrib/auth/decorators.py\", line 21, in _wrapped_view\n    return view_func(request, *args, **kwargs)\n  File \"/usr/local/lib/python3.6/dist-packages/django/contrib/auth/decorators.py\", line 21, in _wrapped_view\n    return view_func(request, *args, **kwargs)\n  File \"/match4healthcare-backend/apps/iamstudent/views.py\", line 224, in student_list_view\n    distance = int(request.GET.get('distance', distance))\nValueError: invalid literal for int() with base 10: '6,5'"
}