Compare commits

..

No commits in common. "0e57a76ce6c435cbf021bd61e5d75f0b72bf2b32" and "1cfb5129fa5578ade5bd136056872ad899bb7d1c" have entirely different histories.

3 changed files with 3 additions and 5 deletions

View file

@ -32,13 +32,11 @@ class AltStyle < ApplicationRecord
} }
scope :by_series_main_name, -> { scope :by_series_main_name, -> {
# The main part of the series name, like "Nostalgic". # The main part of the series name, like "Nostalgic".
# If there's no colon, uses the whole string.
order(Arel.sql("SUBSTRING_INDEX(series_name, ': ', -1)")) order(Arel.sql("SUBSTRING_INDEX(series_name, ': ', -1)"))
} }
scope :by_series_variant_name, -> { scope :by_series_variant_name, -> {
# The variant part of the series name, like "Prismatic Cyan". # The variant part of the series name, like "Prismatic Cyan".
# If there's no colon, uses an empty string. order(Arel.sql("SUBSTRING_INDEX(series_name, ': ', 1)"))
order(Arel.sql("SUBSTRING(series_name, 1, LOCATE(': ', series_name) - 1)"))
} }
scope :by_color_name, -> { scope :by_color_name, -> {
joins(:color).order(Color.arel_table[:name]) joins(:color).order(Color.arel_table[:name])

View file

@ -60,7 +60,7 @@ module Neopets::NCMall
["Cookie", "neologin=#{neologin}"], ["Cookie", "neologin=#{neologin}"],
["X-Requested-With", "XMLHttpRequest"], ["X-Requested-With", "XMLHttpRequest"],
], ],
{tab:, mode: "getAvailable", species: species_id}.to_query, {tab:, mode: "getStyles", species: species_id}.to_query,
) do |response| ) do |response|
if response.status != 200 if response.status != 200
raise ResponseNotOK.new(response.status), raise ResponseNotOK.new(response.status),

View file

@ -58,7 +58,7 @@ RSpec.describe Neopets::NCMall, type: :model do
"Cookie": "neologin=STUB_NEOLOGIN", "Cookie": "neologin=STUB_NEOLOGIN",
"User-Agent": Rails.configuration.user_agent_for_neopets, "User-Agent": Rails.configuration.user_agent_for_neopets,
}, },
body: "mode=getAvailable&species=2&tab=#{tab}", body: "mode=getStyles&species=2&tab=#{tab}",
) )
end end