Split Item Getting Guide between NC Mall items and Other NC items

This'll affect the recommended acquisition method by a lot!

NC Mall info like current price isn't surfaced anywhere else in the app
right now. It'd probably be good to add to the item page, and maybe
some other places too!
This commit is contained in:
Emi Matchu 2024-05-14 00:09:27 -07:00
parent 46d3325144
commit d3b3a3060c
3 changed files with 15 additions and 5 deletions

View file

@ -114,14 +114,15 @@ class ItemsController < ApplicationController
def sources
item_ids = params[:ids].split(",")
@items = Item.where(id: item_ids).order(:name)
@items = Item.where(id: item_ids).includes(:nc_mall_record).order(:name)
if @items.empty?
render file: "public/404.html", status: :not_found, layout: nil
return
end
@nc_items = @items.select(&:nc?)
@nc_mall_items = @items.select(&:currently_in_mall?)
@other_nc_items = @items.select(&:nc?).reject(&:currently_in_mall?)
@np_items = @items.select(&:np?)
@pb_items = @items.select(&:pb?)

View file

@ -8,6 +8,7 @@ class Item < ApplicationRecord
has_many :closet_hangers
has_one :contribution, :as => :contributed, :inverse_of => :contributed
has_one :nc_mall_record
has_many :parent_swf_asset_relationships, :as => :parent
has_many :swf_assets, :through => :parent_swf_asset_relationships
@ -162,6 +163,10 @@ class Item < ApplicationRecord
!nc? && !pb?
end
def currently_in_mall?
nc_mall_record.present?
end
def owned?
@owned || false
end

View file

@ -1,9 +1,9 @@
- title "Item Getting Guide"
%h1#title Item Getting Guide
- if @nc_items.present?
%h2 Neocash items
= render @nc_items
- if @nc_mall_items.present?
%h2 NC Mall items
= render @nc_mall_items
- if @np_items.present?
%h2 Neopoint items
@ -12,3 +12,7 @@
- if @pb_items.present?
%h2 Paintbrush items
= render @pb_items
- if @other_nc_items.present?
%h2 Other NC items
= render @other_nc_items