praekeltfoundation / go-nike-ghr

Nike Girl Effect GHR
1 stars 0 forks source link

M&L Questions API shouldn't return traceback #60

Open imsickofmaps opened 10 years ago

imsickofmaps commented 10 years ago

When something is marked as active and complete but then questions are removed to make it incomplete the API call fails. It should validate completeness and not include incomplete records in its response.

imsickofmaps commented 10 years ago

@justinvdm please add traceback

justinvdm commented 10 years ago

Traceback:

{"error_message": "max() arg is an empty sequence", "traceback": "Traceback (most recent call last):\n\n  File \"/var/praekelt/ghr/ve/local/lib/python2.7/site-packages/tastypie/resources.py\", line 217, in wrapper\n    response = callback(request, *args, **kwargs)\n\n  File \"/var/praekelt/ghr/ve/local/lib/python2.7/site-packages/tastypie/resources.py\", line 459, in dispatch_list\n    return self.dispatch('list', request, **kwargs)\n\n  File \"/var/praekelt/ghr/ve/local/lib/python2.7/site-packages/tastypie/resources.py\", line 491, in dispatch\n    response = method(request, **kwargs)\n\n  File \"/var/praekelt/ghr/ve/local/lib/python2.7/site-packages/tastypie/resources.py\", line 1313, in get_list\n    to_be_serialized = self.alter_list_data_to_serialize(request, to_be_serialized)\n\n  File \"/var/praekelt/ghr/monitor_and_learn/api.py\", line 47, in alter_list_data_to_serialize\n    last_question_id = max([questions[i].data[\"id\"] for i in range(len(questions))])\n\nValueError: max() arg is an empty sequence\n"}