You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now if you enter begin and end in reverse order, say begin: 1950, end: 1900 -- an exception gets raised, is not caught, resulting in a 500 in an app.
It would be nice if these were just automatically reversed to do the only thing that can be done with them instead. (If infeasible, I guess just ignoring might be better than raising an uncaught exception?)
I started to look at this, but there were a lot of layers, and i wasn't sure of a good way to do it. So prob not to be included in 9.0.0.
In my own app, I detect and reverse them with a before_action, but i'm not sure this is actually the best or right way when we can change code at layers a consuming app doesn't have access to.
Here is a controller test that could test for it....
require'spec_helper'RSpec.describeCatalogController,type: :controllerdoincludeDevise::Test::ControllerHelperslet(:range_facet_field){"pub_date_si"}describe"range value out of order"dorender_viewslet(:out_of_order_range_params)do{range: {range_facet_field=>{begin: "2010",end: "2000"}}}endit"treats as if ordered properly"doget:index,params: out_of_order_range_paramsexpect(response.status).toeq(200)expect(response.body).toinclude("2000 to 2010")endendend
The text was updated successfully, but these errors were encountered:
Right now if you enter begin and end in reverse order, say
begin: 1950
,end: 1900
-- an exception gets raised, is not caught, resulting in a 500 in an app.It would be nice if these were just automatically reversed to do the only thing that can be done with them instead. (If infeasible, I guess just ignoring might be better than raising an uncaught exception?)
I started to look at this, but there were a lot of layers, and i wasn't sure of a good way to do it. So prob not to be included in 9.0.0.
In my own app, I detect and reverse them with a
before_action
, but i'm not sure this is actually the best or right way when we can change code at layers a consuming app doesn't have access to.https://github.com/sciencehistory/scihist_digicoll/blob/f76ac4e22959fa344226546bb7cd09bda874612c/app/controllers/catalog_controller.rb#L10C18-L10C51
https://github.com/sciencehistory/scihist_digicoll/blob/f76ac4e22959fa344226546bb7cd09bda874612c/app/controllers/catalog_controller.rb#L669-L682
Here is a controller test that could test for it....
The text was updated successfully, but these errors were encountered: