adaptive-learning / geography

Intelligent application for practicing map outlines.
http://www.slepemapy.cz
MIT License
6 stars 4 forks source link

KeyError at /question/cz/river #93

Closed slaweet closed 10 years ago

slaweet commented 10 years ago

I'm getting KeyError on this url: http://staging.slepemapy.cz/question/cz/river the problem is

File "/var/www/slepemapy.cz/subdomains/staging/geography/models/knowledge.py" in <lambda>
  78.                 return map(lambda i: found[i], place_ids)

But i'm not sure what exactly should this code do

Full info:

Environment:

Request Method: GET
Request URL: http://staging.slepemapy.cz/question/cz/river

Django Version: 1.5.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sitemaps',
 'modeltranslation',
 'django.contrib.admin',
 'south',
 'social_auth',
 'lazysignup',
 'geography')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'geography.middleware.LanguageInPathMiddleware',
 'geography.middleware.SqldumpMiddleware',
 'geography.middleware.AuthAlreadyAssociatedMiddleware')

Traceback:
File "/var/www/slepemapy.cz/virtualenv/geography-staging/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/slepemapy.cz/virtualenv/geography-staging/lib/python2.7/site-packages/lazysignup/decorators.py" in wrapped
  45.         return func(request, *args, **kwargs)
File "/var/www/slepemapy.cz/subdomains/staging/geography/views/question.py" in question
  36.     response = qs.get_questions(10 - question_index, place_types)
File "/var/www/slepemapy.cz/subdomains/staging/geography/utils/model.py" in get_questions
  68.             self.ab_env), [None for i in range(n - len(candidates))])
File "/var/www/slepemapy.cz/subdomains/staging/geography/models/place.py" in get_places_to_ask
  101.             target_probability=target_prob)
File "/var/www/slepemapy.cz/virtualenv/geography-staging/lib/python2.7/site-packages/proso/geography/recommendation.py" in by_additive_function
  82.         confused_indexes = map(lambda target: env.confused_index(target, place_ids), targets)
File "/var/www/slepemapy.cz/virtualenv/geography-staging/lib/python2.7/site-packages/proso/geography/recommendation.py" in <lambda>
  82.         confused_indexes = map(lambda target: env.confused_index(target, place_ids), targets)
File "/var/www/slepemapy.cz/subdomains/staging/geography/models/knowledge.py" in confused_index
  121.             place_answered_num = self.answers_num(place_id=place_id)
File "/var/www/slepemapy.cz/subdomains/staging/geography/models/knowledge.py" in answers_num
  50.         return self.answers_nums([user_id], [place_id])[0]
File "/var/www/slepemapy.cz/subdomains/staging/geography/models/knowledge.py" in answers_nums
  78.                 return map(lambda i: found[i], place_ids)
File "/var/www/slepemapy.cz/subdomains/staging/geography/models/knowledge.py" in <lambda>
  78.                 return map(lambda i: found[i], place_ids)

Exception Type: KeyError at /question/cz/river
Exception Value: 1246L
papousek commented 10 years ago

Good catch!