Include coach titles.
parent
8a3320e279
commit
eb812d8366
|
@ -65,7 +65,7 @@ function SearchResults({ searchParams }: { searchParams: SearchParams }) {
|
||||||
<SearchResult
|
<SearchResult
|
||||||
src={coach.image_url ?? ""}
|
src={coach.image_url ?? ""}
|
||||||
title={coach.name ?? ""}
|
title={coach.name ?? ""}
|
||||||
subtitle={coach.name ?? ""}
|
subtitle={coach.title ?? ""}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href={
|
href={
|
||||||
coach.site === "lichess"
|
coach.site === "lichess"
|
||||||
|
|
|
@ -3,6 +3,7 @@ export type Coach = {
|
||||||
username: string
|
username: string
|
||||||
name: string | null
|
name: string | null
|
||||||
image_url: string | null
|
image_url: string | null
|
||||||
|
title: string | null
|
||||||
languages: string[] | null
|
languages: string[] | null
|
||||||
rapid: number | null
|
rapid: number | null
|
||||||
blitz: number | null
|
blitz: number | null
|
||||||
|
|
|
@ -78,7 +78,7 @@ defmodule BoardWise.Coaches do
|
||||||
|> selected_as(:score)
|
|> selected_as(:score)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|> order_by(desc: selected_as(:score))
|
|> order_by(desc: selected_as(:score), asc: :username)
|
||||||
|> limit(^page_size)
|
|> limit(^page_size)
|
||||||
|> offset(^((page_no - 1) * page_size))
|
|> offset(^((page_no - 1) * page_size))
|
||||||
|> Repo.all(prefix: @prefix)
|
|> Repo.all(prefix: @prefix)
|
||||||
|
|
|
@ -22,6 +22,7 @@ defmodule BoardWise.Coaches.Coach do
|
||||||
# optional fields
|
# optional fields
|
||||||
field :name, :string
|
field :name, :string
|
||||||
field :image_url, :string
|
field :image_url, :string
|
||||||
|
field :title, :string
|
||||||
field :languages, {:array, :string}
|
field :languages, {:array, :string}
|
||||||
field :blitz, :integer
|
field :blitz, :integer
|
||||||
field :bullet, :integer
|
field :bullet, :integer
|
||||||
|
@ -39,6 +40,7 @@ defmodule BoardWise.Coaches.Coach do
|
||||||
:username,
|
:username,
|
||||||
:name,
|
:name,
|
||||||
:image_url,
|
:image_url,
|
||||||
|
:title,
|
||||||
:languages,
|
:languages,
|
||||||
:rapid,
|
:rapid,
|
||||||
:blitz,
|
:blitz,
|
||||||
|
|
|
@ -14,6 +14,7 @@ defmodule BoardWiseWeb.CoachJSON do
|
||||||
username: coach.username,
|
username: coach.username,
|
||||||
name: coach.name,
|
name: coach.name,
|
||||||
image_url: coach.image_url,
|
image_url: coach.image_url,
|
||||||
|
title: coach.title,
|
||||||
languages: coach.languages,
|
languages: coach.languages,
|
||||||
rapid: coach.rapid,
|
rapid: coach.rapid,
|
||||||
blitz: coach.blitz,
|
blitz: coach.blitz,
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
defmodule BoardWise.Repo.Migrations.Titles do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
@prefix "coach_scraper"
|
||||||
|
|
||||||
|
def change do
|
||||||
|
alter table(:export, prefix: @prefix) do
|
||||||
|
add :title, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue