Include coach titles.

main
Joshua Potter 2023-12-06 19:59:29 -07:00
parent 8a3320e279
commit eb812d8366
6 changed files with 17 additions and 2 deletions

View File

@ -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"

View File

@ -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

View File

@ -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)

View File

@ -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,

View File

@ -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,

View File

@ -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