Skip to content
This repository was archived by the owner on Feb 16, 2022. It is now read-only.

Commit 26d77a5

Browse files
authored
Merge pull request #4 from LendingHome/mw/fix-name-sort
Fix server name sorting
2 parents 067ac0d + 0ad1e37 commit 26d77a5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/staging/lib/schemas/server.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ defmodule Staging.Server do
3232

3333
def order_by_name(query) do
3434
from s in query, order_by: [
35-
fragment("regexp_matches(?, '^\D+')::text[]", s.name),
36-
fragment("regexp_matches(?, '\d+$')::int[]", s.name)
35+
fragment("substring(? from '^\\D+')", s.name),
36+
fragment("substring(? from '\\d+$')::int", s.name)
3737
]
3838
end
3939

apps/staging/spec/staging_bot_spec.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ defmodule Staging.BotSpec do
7272

7373
it "lists the servers alphabetically by name prefix then numerically by index suffix" do
7474
Bot.handle_event(%{type: "message", text: "#{@bot_name} list", channel: @channel, user: @message_user.id}, @slack, [])
75-
response = string_matching(~r/beta-2.+beta-21.+qa-1.+qa-11/iu)
75+
response = string_matching(~r/beta-2.+beta-21.+qa-1.+qa-11/ius)
7676
expect(@slack_send).to have_received([response, @channel, @slack])
7777
end
7878
end

0 commit comments

Comments
 (0)