File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -57,18 +57,19 @@ def edit
5757 # TODO: Move these queries to Query Object
5858 def show
5959 @storage_location = current_organization . storage_locations . find ( params [ :id ] )
60+ version_date = params [ :version_date ] . presence &.to_date
6061 # TODO: Find a way to do these with less hard SQL. These queries have to be manually updated because they're not in-sync with the Model
6162 @items_out = ItemsOutQuery . new ( organization : current_organization , storage_location : @storage_location ) . call
6263 @items_out_total = ItemsOutTotalQuery . new ( organization : current_organization , storage_location : @storage_location ) . call
6364 @items_in = ItemsInQuery . new ( organization : current_organization , storage_location : @storage_location ) . call
6465 @items_in_total = ItemsInTotalQuery . new ( organization : current_organization , storage_location : @storage_location ) . call
65- if View ::Inventory . within_snapshot? ( current_organization . id , params [ : version_date] )
66- @inventory = View ::Inventory . new ( current_organization . id , event_time : params [ : version_date] )
66+ if View ::Inventory . within_snapshot? ( current_organization . id , version_date )
67+ @inventory = View ::Inventory . new ( current_organization . id , event_time : version_date )
6768 else
6869 @legacy_inventory = View ::Inventory . legacy_inventory_for_storage_location (
6970 current_organization . id ,
7071 @storage_location . id ,
71- params [ : version_date]
72+ version_date
7273 )
7374 end
7475
Original file line number Diff line number Diff line change 324324 expect ( response . body ) . to include ( "200" )
325325 end
326326
327+ it "should return a correct response with empty version date param" do
328+ get storage_location_path ( storage_location , format : response_format ,
329+ version_date : '' )
330+ expect ( response ) . to be_successful
331+ expect ( response . body ) . to include ( "Smithsonian" )
332+ expect ( response . body ) . to include ( "Test Item" )
333+ expect ( response . body ) . to include ( "Test Item2" )
334+ expect ( response . body ) . not_to include ( "Test Item3" )
335+ expect ( response . body ) . to include ( "200" )
336+ end
337+
327338 context "with version date set" do
328339 let! ( :inventory_item ) {
329340 InventoryItem . create! ( storage_location_id : storage_location . id ,
You can’t perform that action at this time.
0 commit comments