Compare commits
2 commits
1cfb5129fa
...
0e57a76ce6
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e57a76ce6 | |||
| 14be40a292 |
3 changed files with 5 additions and 3 deletions
|
|
@ -32,11 +32,13 @@ 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".
|
||||||
order(Arel.sql("SUBSTRING_INDEX(series_name, ': ', 1)"))
|
# If there's no colon, uses an empty string.
|
||||||
|
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])
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ module Neopets::NCMall
|
||||||
["Cookie", "neologin=#{neologin}"],
|
["Cookie", "neologin=#{neologin}"],
|
||||||
["X-Requested-With", "XMLHttpRequest"],
|
["X-Requested-With", "XMLHttpRequest"],
|
||||||
],
|
],
|
||||||
{tab:, mode: "getStyles", species: species_id}.to_query,
|
{tab:, mode: "getAvailable", 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),
|
||||||
|
|
|
||||||
|
|
@ -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=getStyles&species=2&tab=#{tab}",
|
body: "mode=getAvailable&species=2&tab=#{tab}",
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue