briot / geneapro

Genealogical software based on the GenTech data model
http://briot.github.com/geneapro/
GNU General Public License v2.0
33 stars 8 forks source link

"Quilt" report gives an error #12

Closed ghost closed 11 years ago

ghost commented 11 years ago

Selecting the "quilt" report gives the following error:

Environment:

Request Method: GET Request URL: http://127.0.0.1:8000/quilts/15

Django Version: 1.4.1 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', 'geneapro') Installed Middleware: ('mysites.middleware.simple_exception.AJAXSimpleExceptionResponse', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware')

Traceback: File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response

  1. response = callback(request, _callback_args, *_callback_kwargs) File "/home/pat/git/geneapro/geneapro/views/graph.py" in quilts_view
  2. data = graph.json(subset) File "/home/pat/git/geneapro/geneapro/views/graph.py" in json
  3. families = self.sort_families(layers, families) File "/home/pat/git/geneapro/geneapro/views/graph.py" in sort_families
  4. byLayer[rightMostLayer + 1].append(family)

Exception Type: KeyError at /quilts/15 Exception Value: 5

ghost commented 11 years ago

Tried against the latest updates and could not make this happen again.

Thank you -Pat

briot commented 11 years ago

Tried against the latest updates and could not make this happen again.

Probably pure luck. The issue occurs when we chose the subset of persons to display, which might end up with empty boxes which are thus pruned. But the computation of the column in which the families should be displayed does not properly take into account these pruned boxes, and we can end up with invalid indexes.

I am reviewing the whole layout for quilts anyway. The layer assignment algorithm I am using is too naive and we end up with lots of persons in the right-most box , even though their parents might be in much older generations. Not a simple algorithm, and I'd prefer to write it in python rather than depend on graphviz, as the choice was done for Gramps.

Thanks for all the reports this week. It is always too easy to concentrate on the "fun" stuff, but it is also important to make sure that newcomers to the project can at least get started conveniently.

Emmanuel