From a3bd841bb8d8f5a6712ad8c22719fcaf246d79e5 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Wed, 5 Jun 2024 19:45:39 -0700 Subject: [PATCH] Fix handling of basic PB items in Item Getting Guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Okay so, like 30 minutes ago I added fallback behavior for cases where we can't correctly infer the color from a PB item's nameā€¦ and then I pulled it up in the color and found that, oh, right, there are already 3 PB items that *correctly* return `nil` for `Item#pb_color`: Aisha Collar, Elephante Hat, and Ixi Collar. This is because they're common items that apply to many colors, like the basics, but also many other less-special or older color variants. They are the most likely case where we'll return `nil`. So, I've updated our fallback UI to, instead of talk vaguely about missing data, just assume that we're dealing with basic items. In the rare window of time where a new color is released, and we have PB items for it but no manual color data yet, this can just incorrectly say "Basic Colors" and that's fine. --- app/views/items/sources.html.haml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/items/sources.html.haml b/app/views/items/sources.html.haml index 6fd9cc71..a672ed57 100644 --- a/app/views/items/sources.html.haml +++ b/app/views/items/sources.html.haml @@ -71,11 +71,14 @@ = image_tag pet_type_image_url(@pb_color_pet_types[color], size: :face), srcset: ["#{pet_type_image_url(@pb_color_pet_types[color], size: :face_2x)} 2x"], alt: @pb_color_pet_types[color].human_name + - else + = image_tag "https://images.neopets.com/items/starter_red_pb.gif", + alt: "Item thumbnail for Starter Red Paint Brush" %th - if color #{color.pb_item_name || color.name.humanize} - else - ??? New color + Basic colors (#{pluralize items.size, "item"}) %td.actions-cell - if color&.pb_item_name? @@ -90,7 +93,7 @@ Get via Lab Ray, morphing potions, etc. - else .special-color-explanation - We don't have info about this color yet. + Many colors, like Red, will grant this item. %tbody - items.each do |item| = render "item_list_row", item: