Skip to content

Commit fd6db67

Browse files
committed
feat: add tech stack and country filtering to talents admin page
- Add embedded Form schema with tech_stack and countries fields - Implement comma-separated input transformation to arrays - Add real-time filter form with visual feedback (tech badges, country flags) - Add filtering logic that matches user tech_stack and country fields - Maintain filter state in URL parameters for bookmarkable URLs - Add update_filters and clear_filters event handlers - Preserve existing sorting and pagination functionality Mirrors the filtering implementation from candidates_live.ex exactly
1 parent 77bdf4c commit fd6db67

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

lib/algora/jobs/jobs.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ defmodule Algora.Jobs do
5959
# Need to handle different query structures based on joins
6060
case query.joins do
6161
# When we have interview join, the user table is the 3rd binding ([j, i, u])
62-
[_interview_join, _user_join] -> where(query, [j, i, u], u.provider_login in ^handles)
62+
[_interview_join, _user_join] -> where(query, [j, i, u], u.provider_login in ^handles or u.handle in ^handles)
6363
# When we only have user join, it's the 2nd binding ([j, u])
64-
[_user_join] -> where(query, [j, u], u.provider_login in ^handles)
64+
[_user_join] -> where(query, [j, u], u.provider_login in ^handles or u.handle in ^handles)
6565
# No joins yet, will be added later
66-
[] -> where(query, [j, u], u.provider_login in ^handles)
66+
[] -> where(query, [j, u], u.provider_login in ^handles or u.handle in ^handles)
6767
end
6868
end
6969

@@ -81,11 +81,11 @@ defmodule Algora.Jobs do
8181
case opts[:order_by] do
8282
:last_interview_desc ->
8383
# Sort by most recent interview, then by job posting date
84-
# Use COALESCE to handle NULL values for jobs without interviews
84+
# Use LEFT JOIN to include all jobs, even those without interviews
8585
query
8686
|> join(:left, [j], i in "job_interviews", on: i.job_posting_id == j.id)
8787
|> group_by([j], [j.id, j.inserted_at])
88-
|> order_by([j, i], [desc: coalesce(max(i.inserted_at), j.inserted_at), desc: j.inserted_at])
88+
|> order_by([j, i], desc: coalesce(max(i.inserted_at), j.inserted_at), desc: j.inserted_at)
8989

9090
_ ->
9191
# Default ordering by job posting date
@@ -94,7 +94,7 @@ defmodule Algora.Jobs do
9494
end
9595

9696
defp apply_preloads(jobs, opts) do
97-
preloads = [:user | (opts[:preload] || [])]
97+
preloads = [:user | opts[:preload] || []]
9898
Repo.preload(jobs, preloads)
9999
end
100100

lib/algora/workspace/workspace.ex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -697,11 +697,7 @@ defmodule Algora.Workspace do
697697

698698
query =
699699
if strict_tech_stack do
700-
where(
701-
query,
702-
[uc, u, r, repo_owner],
703-
fragment("(SELECT ARRAY(SELECT unnest(?) LIMIT 1)) && ?::citext[]", r.tech_stack, ^tech_stack)
704-
)
700+
where(query, [uc, u, r, repo_owner], fragment("? && ?::citext[]", r.tech_stack, ^tech_stack))
705701
else
706702
query
707703
end

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ defmodule Algora.MixProject do
102102
{:csv, "~> 3.2"},
103103
{:instructor, "~> 0.1.0"},
104104
{:openai_ex, "~> 0.9.12"},
105-
{:hound, "~> 1.1", only: [:dev]},
105+
{:hound, "~> 1.1"},
106106
# ex_aws
107107
{:ex_aws, "~> 2.1"},
108108
{:ex_aws_s3, "~> 2.0"},

0 commit comments

Comments
 (0)