Include coach titles.
parent
8a3320e279
commit
eb812d8366
|
@ -65,7 +65,7 @@ function SearchResults({ searchParams }: { searchParams: SearchParams }) {
|
|||
<SearchResult
|
||||
src={coach.image_url ?? ""}
|
||||
title={coach.name ?? ""}
|
||||
subtitle={coach.name ?? ""}
|
||||
subtitle={coach.title ?? ""}
|
||||
target="_blank"
|
||||
href={
|
||||
coach.site === "lichess"
|
||||
|
|
|
@ -3,6 +3,7 @@ export type Coach = {
|
|||
username: string
|
||||
name: string | null
|
||||
image_url: string | null
|
||||
title: string | null
|
||||
languages: string[] | null
|
||||
rapid: number | null
|
||||
blitz: number | null
|
||||
|
|
|
@ -78,7 +78,7 @@ defmodule BoardWise.Coaches do
|
|||
|> selected_as(:score)
|
||||
}
|
||||
)
|
||||
|> order_by(desc: selected_as(:score))
|
||||
|> order_by(desc: selected_as(:score), asc: :username)
|
||||
|> limit(^page_size)
|
||||
|> offset(^((page_no - 1) * page_size))
|
||||
|> Repo.all(prefix: @prefix)
|
||||
|
|
|
@ -22,6 +22,7 @@ defmodule BoardWise.Coaches.Coach do
|
|||
# optional fields
|
||||
field :name, :string
|
||||
field :image_url, :string
|
||||
field :title, :string
|
||||
field :languages, {:array, :string}
|
||||
field :blitz, :integer
|
||||
field :bullet, :integer
|
||||
|
@ -39,6 +40,7 @@ defmodule BoardWise.Coaches.Coach do
|
|||
:username,
|
||||
:name,
|
||||
:image_url,
|
||||
:title,
|
||||
:languages,
|
||||
:rapid,
|
||||
:blitz,
|
||||
|
|
|
@ -14,6 +14,7 @@ defmodule BoardWiseWeb.CoachJSON do
|
|||
username: coach.username,
|
||||
name: coach.name,
|
||||
image_url: coach.image_url,
|
||||
title: coach.title,
|
||||
languages: coach.languages,
|
||||
rapid: coach.rapid,
|
||||
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