openbenches.org icon indicating copy to clipboard operation
openbenches.org copied to clipboard

A new bench could be saved without some of the images and without warning.

Open arizonagroovejet opened this issue 7 years ago • 1 comments
trafficstars

Steps to recreate:

  • Click "Add new Bench" button.
  • Select image A which is a photo of an inscription.
  • Select image B which is a photo of the bench.
  • Click "Share Bench" button.
  • Click "Add new Bench" button.
  • Select image C which is a photo of an inscription.
  • Select image B for whatever reason. Accidents happen.
  • Click "Share Bench" button.

Expected (? Desired?) results: The bench does not get submitted. Some sort of message appears informing that image B has already been submitted and the user has a chance to correct the issue.

Actual results: The bench is successfully submitted without any indication of there being a problem. Image B doesn't show up on the bench page. User probably wonders why there's only one photo on their submission instead of two.

I haven't experienced this issue, I suspected it's existence whilst reading the code and then confirmed it using a local instance of the OpenBenches code.

The save_image() function returns some text if asked to save a duplicate image, but in add.php that text isn't assigned to a variable for three of the calls to save_image() https://github.com/edent/openbenches/blob/8ea9be3cc73a5b503f181226cfffb7cf2b0c8ed3/www/add.php#L54 https://github.com/edent/openbenches/blob/8ea9be3cc73a5b503f181226cfffb7cf2b0c8ed3/www/add.php#L67 https://github.com/edent/openbenches/blob/8ea9be3cc73a5b503f181226cfffb7cf2b0c8ed3/www/add.php#L74

By contrast, in edit.php the output of save_image() is always assigned and an error message built up and displayed https://github.com/edent/openbenches/blob/8ea9be3cc73a5b503f181226cfffb7cf2b0c8ed3/www/edit.php#L56 https://github.com/edent/openbenches/blob/8ea9be3cc73a5b503f181226cfffb7cf2b0c8ed3/www/edit.php#L95 Possibly the fix is do what edit.php does in add.php. :man_shrugging:

arizonagroovejet avatar Oct 03 '18 20:10 arizonagroovejet

Yes, I think that's a good idea.

edent avatar Oct 05 '18 08:10 edent

The new version of the code will allow the same photo to be uploaded to multiple benches. The reduces the number of errors users see, and makes the logic a lot easier. If they notice they've made a mistake they can delete the bench and start again.

I occasionally run a check to see an image has been attached to multiple benches. It only happens rarely.

edent avatar Jul 29 '23 20:07 edent