montera34 / pageonex

PageOneX. Analyzing front pages
http://pageonex.com
GNU Affero General Public License v3.0
54 stars 13 forks source link

Areas get saved wrongly in production site while coding #133

Closed numeroteca closed 11 years ago

numeroteca commented 11 years ago

When coding this image http://production.pageonex.com/numeroteca/test-open-thread-for-media-lab-festival/coding/?i=boston_globe-2013-04-16 the areas get stored wrongly: smaller size in the wrong place, sometimes and extra blue area appears. This behavior was not happening in the dev site: http://dev.pageonex.com/numeroteca/test-open-thread-for-media-lab-festival/

This same bug happens in other threads such as http://production.pageonex.com/numeroteca/test3/coding/?i=laopinion-2013-04-26 I created an area as big as the image. The area that gets store is half the size.

numeroteca commented 11 years ago

User must save the thread twice while coding, to make areas properly work in the display view.

elplatt commented 11 years ago

This happens when one highlighted_area has more than one area. I'm not yet sure how that is happening, but there should be exactly one highlighted_area for each area and vice versa.

elplatt commented 11 years ago

I can't reproduce this on my development instance. Anyone else see why the prod server would create two areas for one highlighted_area? Relevant code is around coding_controller.rb:29.

numeroteca commented 11 years ago

I made a comment on 3b087e4. If I understood it correctly: I also can not reproduce it locally (sqlite), as it is an specific issue of the mysql primary key when we transferred the data base from sqlite. Rahul commented that when we would reach 100 more areas the id numbers will not be anymore repeated and it would work, but it will not solve this issue, obviously. does it help?

elplatt commented 11 years ago

I ran the following code to delete the orphaned areas, and it looks like things are working now.

Area.joins('LEFT OUTER JOIN highlighted_areas ON highlighted_areas.id = highlighted_area_id').where("highlighted_areas.id IS NULL").destroy_all