Maps from fixtures have wrong thumbnail

Bug #1375758 reported by Daniele Viganò
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake Platform
Fix Committed
High
Daniele Viganò
summary: - Maps from fixtures contains have wrong thumbnail
+ Maps from fixtures have wrong thumbnail
Revision history for this message
Paul Henshaw (paul-sl-henshaw) wrote :

I have seen a problem which is probably related to this error:

on the staging platform I have updated the metadata of a number of layers and maps (ISC, GAF, GHEC...) via the web interface.

If I search for ISC I find one map and two layers - I would expect to find only one layer.

The id of the extra layer is "oqplatform:event" which seems odd.

There is a thumbnail for this layer which includes a background map as well as the ISC vector points. If I click on the layer I can view the metadata - I note that the legend has a single entry "Red Square" and that there are no visible points in the layer. I note further that the metadata is identical to that of the ISC Map (map/1).

If I then click on "Create New Map" a GeoNode error page is displayed.

I return to "layers/oqplatform:event"

I open the ISC map "(map/1)" in a new tab, and update the metadata title to include some new text.

I refresh the "oqplatform:event" tab and see that the title contains the new text added to the ISC map.

Revision history for this message
Daniele Viganò (daniele-vigano) wrote :

Issue is under investigation and seems related to a problem of IDs and foreign keys in the fixture we use to put the maps on during the installation process.

See:
https://github.com/gem/oq-platform/pull/168
https://github.com/gem/oq-platform/blob/master/openquakeplatform/openquakeplatform/maps_viewer/post_fixtures/ghec_map_layer.json#L21

Revision history for this message
Daniele Viganò (daniele-vigano) wrote :
Download full text (4.1 KiB)

The problem is caused when we try to rename the Maps using https://github.com/gem/oq-platform/blob/master/openquakeplatform/openquakeplatform/maps_viewer/management/commands/map_title.py#L28

For example, for GHEC both GHEC map and a FE layer have id = 2. The code changes the title to both.

We tried using Map instead of ResourceBase but the problem is stille there. It looks like that the root cause is stille an issue with IDs and fixtures:

from geonode.maps.models import Map

class Command(BaseCommand):

    def handle(self, *args, **options):
     titles = ((1, "Instrumental Seismic Catalogue"), (2, "Global Historic Catalogue"), (3, "Global Active Faults"))
     for id, name in titles:
         table_row = Map.objects.get(id=id)
         table_row.title = name
         table_row.save()

If we try to change the layer or map name in the Django admin console with get an ugly error related to keys:

Traceback:
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115. response = callback(request, *callback_args, **callback_kwargs)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  372. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  91. response = view_func(request, *args, **kwargs)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  89. response = view_func(request, *args, **kwargs)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  202. return view(request, *args, **kwargs)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  25. return bound_func(*args, **kwargs)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  91. response = view_func(request, *args, **kwargs)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  21. return func(self, *args2, **kwargs2)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
  223. return func(*args, **kwargs)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in change_view
  1100. queryset=inline.queryset(request))
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/forms/models.py" in __init__
  720. queryset=qs, **kwargs)
File "/home/openquake/oq-platform/platform-env/local/lib/python2.7/site-packages/django/forms/models.py" in __init__
  441. super(BaseModelFor...

Read more...

Revision history for this message
Daniele Viganò (daniele-vigano) wrote :

The problems was in the fixture. We were using ids already used by other objects. New fixtures are coming.

Changed in oq-platform:
status: Confirmed → In Progress
Revision history for this message
Daniele Viganò (daniele-vigano) wrote :
Revision history for this message
Daniele Viganò (daniele-vigano) wrote :

New fixtures pushed

Changed in oq-platform:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.