Openfoodnetwork: ActiveRecord::StatementInvalid in admin/order_cycles#update

Created on 7 Dec 2018  路  5Comments  路  Source: openfoodfoundation/openfoodnetwork

Description

Entering pick up instructions that exceed 255 characters leads to a server error.

ActiveRecord::StatementInvalid in admin/order_cycles#update
PG::StringDataRightTruncation: ERROR: value too long for type character varying(255)
: UPDATE "exchanges" SET "pickup_instructions" = 'Pick up options are: - Theatre Royal courtyard (#30 Hargraves St) in Castlemaine between 5pm and 6pm on a Wednesday - Drop into the Harcourt Organic Farming Co-op shop (phew mouthful!) in Harcourt Weds or Friday 10am-4pm.', "updated_at" = '2018-12-07 00:23:13.552177' WHERE "exchanges"."id" = 66943

View on Bugsnag

gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/postgresql_adapter.rb:1163 - async_exec

View full stacktrace

Expected Behavior

It should not be possible to enter instructions that exceed the character limit of the database. Updating the order cycle should always succeed.

Actual Behavior

A server error is possible.

Steps to Reproduce


  1. Edit an order cycle.
  2. Change the pick up instructions to a long text.
  3. Try to save the changes.

Animated Gif/Screenshot

Not recorded yet.

Context

One of our Australian users experienced this and it got reported through Bugsnag.

Severity


S4 It's annoying when saving fails, but most people can figure out to use a shorter description.

Your Environment

  • Version used: 1052d982550f0b7ac601b399f032291383ddad26

Possible Fix

Limit the text field to the limit of the database field. Maybe evaluate if the limit of the database field should be increased. How would it look like with longer instructions?

bug-s4 bugsnag good first issue hackathon

All 5 comments

Sad...but LOL @sauloperez

I would like to work on this as my first issue.

Yes @jgman please go ahead! 馃檪 Welcome, and please ask if you need any assistance 馃憤

Hi @jgman ! Also, don't hesitate to ask on the dev channel of our Slack team.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

myriamboure picture myriamboure  路  3Comments

Matt-Yorkley picture Matt-Yorkley  路  3Comments

RachL picture RachL  路  3Comments

lin-d-hop picture lin-d-hop  路  3Comments

filipefurtad0 picture filipefurtad0  路  3Comments