Skip to content

Commit 57d6d2c

Browse files
committed
feat: show all tech stack intersection in job matches
- Display all matching technologies between user's skills and job requirements - Add get_matching_techs/3 helper to compute intersection of job tech stack with user tech stack union contributions - Refactor has_matching_tech_stack?/3 to use new helper function
1 parent d1e80d4 commit 57d6d2c

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

lib/algora_web/live/org/job_live.ex

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ defmodule AlgoraWeb.Org.JobLive do
284284
current_user={@current_user}
285285
user={match.user}
286286
tech_stack={@job.tech_stack |> Enum.take(1)}
287+
job={@job}
287288
contributions={Map.get(@contributions_map, match.user.id, [])}
288289
contract_type="bring_your_own"
289290
anonymized={@current_org.hiring_subscription != :active}
@@ -1003,17 +1004,17 @@ defmodule AlgoraWeb.Org.JobLive do
10031004
<div class="flex items-center gap-2">
10041005
<.icon
10051006
name={
1006-
if has_matching_tech_stack?(@user.tech_stack, @tech_stack, @contributions),
1007+
if has_matching_tech_stack?(@user.tech_stack, @job.tech_stack, @contributions),
10071008
do: "tabler-check",
10081009
else: "tabler-x"
10091010
}
10101011
class={
1011-
if has_matching_tech_stack?(@user.tech_stack, @tech_stack, @contributions),
1012+
if has_matching_tech_stack?(@user.tech_stack, @job.tech_stack, @contributions),
10121013
do: "text-success-400",
10131014
else: "text-destructive"
10141015
}
10151016
/>
1016-
<span>Versed in {Enum.join(@tech_stack, ", ")}</span>
1017+
<span>Versed in {get_matching_techs(@user.tech_stack, @job.tech_stack, @contributions) |> Enum.join(", ")}</span>
10171018
</div>
10181019
<% end %>
10191020
</div>
@@ -1760,7 +1761,7 @@ defmodule AlgoraWeb.Org.JobLive do
17601761
Float.round(total_weekend_contributions / total_weekends, 1)
17611762
end
17621763

1763-
defp has_matching_tech_stack?(user_stack, job_stack, contributions) do
1764+
defp get_matching_techs(user_stack, job_stack, contributions) do
17641765
# Get tech stacks from top contributions
17651766
contribution_techs =
17661767
contributions
@@ -1776,6 +1777,15 @@ defmodule AlgoraWeb.Org.JobLive do
17761777
|> MapSet.new(&String.downcase/1)
17771778

17781779
job_set = MapSet.new(Enum.map(job_stack || [], &String.downcase/1))
1779-
!MapSet.disjoint?(all_user_techs, job_set)
1780+
1781+
# Return the intersection
1782+
MapSet.intersection(all_user_techs, job_set)
1783+
|> MapSet.to_list()
1784+
|> Enum.map(&String.capitalize/1)
1785+
end
1786+
1787+
defp has_matching_tech_stack?(user_stack, job_stack, contributions) do
1788+
matching_techs = get_matching_techs(user_stack, job_stack, contributions)
1789+
length(matching_techs) > 0
17801790
end
17811791
end

0 commit comments

Comments
 (0)