1
0
Fork 0
forked from OpenNeo/impress

Oops, fix crashing bug when Item Getting Guide has *no* Dyeworks

Lmao I've been testing with an outfit that has all the kinds of items,
so I didn't notice that this new refactor to `@items[:dyeworks]` style
of tracking the items returns `nil` when there's none, instead of `[]`.
(I always make this mistake when I use `group_by` lmao sob)

In this change, we give the `@items` hash a default value, so that will
stop happening!
This commit is contained in:
Emi Matchu 2024-06-17 13:03:12 -07:00
parent 9f536f81b3
commit 598a9dac52

View file

@ -117,7 +117,7 @@ class ItemsController < ApplicationController
item_ids = params[:ids].split(",") item_ids = params[:ids].split(",")
@all_items = Item.where(id: item_ids).includes(:nc_mall_record). @all_items = Item.where(id: item_ids).includes(:nc_mall_record).
includes(:dyeworks_base_item).order(:name).limit(50) includes(:dyeworks_base_item).order(:name).limit(50)
@items = @all_items.group_by(&:source) @items = @all_items.group_by(&:source).tap { |i| i.default = [] }
assign_closeted!(@all_items) assign_closeted!(@all_items)