montera34 / pageonex

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

Broken thread "invalid scale value" #187

Closed numeroteca closed 10 years ago

numeroteca commented 10 years ago

Bug reported at http://blog.pageonex.com/report-bugs/#comment-696 related to the thread

Well, I think the concept is great, but I found very dissapointing two things; first, when you bumped into a 404 empty page, the previous/following ones which had been highlighted are moved downwards -some css problem it seems- and finally, after doing some twenty pages of scaps, saving failed and I gave up trying again. A lot of work ahead! Greetings from Argentina, Dave.

It is referred to the one year long thread http://pageonex.com/davidmbusto/dragado-en-bahia-blanca/

Moved areas Regarding the css that is reporting I saw the first time I entered the coding view http://pageonex.com/threads/dragado-en-bahia-blanca/coding/, that the areas that he had drawn where moved 50px down. Later, when I entered next time, they were in place.

Crashed thread When edited and saved returns this error:

Started GET "/davidmbusto/dragado-en-bahia-blanca/" for 95.16.127.172 at 2013-09-25 08:06:47 +0000
Processing by CodingController#display as HTML
  Parameters: {"username"=>"davidmbusto", "thread_name"=>"dragado-en-bahia-blanca"}
Creating composites for 'dragado-en-bahia-blanca' (236) at app/assets/images/threads/227/236/970px
  determining row heights
  creating background image grid
Completed 500 Internal Server Error in 410ms

ArgumentError (invalid scale value (-0.00133333 given)):
  app/models/image.rb:63:in `thumbnail'
  app/models/image.rb:63:in `thumbnail'
  lib/image_compositor.rb:87:in `block (2 levels) in generate_front_page_composite'
  lib/image_compositor.rb:79:in `each'
  lib/image_compositor.rb:79:in `each_with_index'
  lib/image_compositor.rb:79:in `block in generate_front_page_composite'
  lib/image_compositor.rb:72:in `each'
  lib/image_compositor.rb:72:in `each_with_index'
  lib/image_compositor.rb:72:in `generate_front_page_composite'
  app/models/threadx.rb:165:in `generate_composite_images'
  app/controllers/coding_controller.rb:90:in `display'

It fails when creating the background image, maybe not surprisingly for a 1 year thread, but also returns the invalid scale value (negative value). Any idea what is happening? @elplatt @rahulbot

We need a way to fail more gracefully and tell the user why it has failed.

As admin I edited the thread length and reduced it to 3 months, and it worked again. The problem is that I edit-saved it without checking the box "Keep all highlighted areas" :/ and I might have lost some of the areas. Is there a way to rescue them in our back up?

elplatt commented 10 years ago

There's not currently an easy way to restore a single thread from backup, but it seems like this is a common need. Would it be acceptable to revert that one thread and all of its highlighted areas to an old version (deleting any recent additions)? If so, what date would be best?

It's probably most effective to add a limit to the length of a thread, will that work? If so, how long is good?

numeroteca commented 10 years ago

About restoring: for this time I think it will not be necessary. I contacted the user and he told that not much was lost. Anyway, the date it crashed was the same day the thread was created, so I don't if it could be restored. Can you explain more how the backup and how to restore would work?

Limiting length: Yes, adding a limit to the length of the thread would help. Now we have a limit of 500 images, so you can create a 1 year 1 newspaper thread, but it crashes. 5 moths seems to work for 1 newspaper and 2 newspapers (ex: http://pageonex.com/numeroteca/test-repeated/). I would say, keep the limit of 500 images AND of 150 days. When creating a thread, we should add a clarification message like "Do not create too long threads. Suggestion: start with one week and then edit and add more days once it is working."

Bugs: any guess why the thread crashed?

elplatt commented 10 years ago

Reproduced locally, working on a fix.

elplatt commented 10 years ago

The problem is that we have 3px of padding for each thumbnail but the width is limited to 970px. I'm checking in a fix to prevent it from crashing, but the images still won't show up for longer threads. Is 6 months a reasonable limit to thread length?

numeroteca commented 10 years ago

6 months is a good limit for a thread. I guess for long threads padding should be 0.