Skip to content

Commit 54efd9b

Browse files
committed
fall back to user's own tech stack in job match cards
1 parent a129a11 commit 54efd9b

File tree

1 file changed

+18
-25
lines changed

1 file changed

+18
-25
lines changed

lib/algora_web/live/org/job_live.ex

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -943,19 +943,11 @@ defmodule AlgoraWeb.Org.JobLive do
943943
<span>Active on weekends</span>
944944
</div>
945945
<div class="flex items-center gap-2">
946-
<.icon
947-
name={
948-
if has_matching_tech_stack?(@user.tech_stack, @job.tech_stack, @contributions),
949-
do: "tabler-check",
950-
else: "tabler-x"
951-
}
952-
class={
953-
if has_matching_tech_stack?(@user.tech_stack, @job.tech_stack, @contributions),
954-
do: "text-success-400",
955-
else: "text-destructive"
956-
}
957-
/>
958-
<span>Versed in {get_matching_techs(@user.tech_stack, @job.tech_stack, @contributions) |> Enum.join(", ")}</span>
946+
<.icon name="tabler-check" class="text-success-400" />
947+
<span>
948+
Versed in {get_matching_techs(@user.tech_stack, @job.tech_stack, @contributions)
949+
|> Enum.join(", ")}
950+
</span>
959951
</div>
960952
<% end %>
961953
</div>
@@ -1706,9 +1698,7 @@ defmodule AlgoraWeb.Org.JobLive do
17061698
# Get tech stacks from top contributions
17071699
contribution_techs =
17081700
contributions
1709-
|> Enum.flat_map(fn contribution ->
1710-
contribution.repository.tech_stack || []
1711-
end)
1701+
|> Enum.flat_map(fn contribution -> Enum.take(contribution.repository.tech_stack, 1) end)
17121702
|> Enum.uniq()
17131703

17141704
# Combine user's declared tech stack with contribution tech stacks
@@ -1718,15 +1708,18 @@ defmodule AlgoraWeb.Org.JobLive do
17181708
|> MapSet.new(&String.downcase/1)
17191709

17201710
job_set = MapSet.new(Enum.map(job_stack || [], &String.downcase/1))
1721-
1722-
# Return the intersection
1723-
MapSet.intersection(all_user_techs, job_set)
1724-
|> MapSet.to_list()
1725-
|> Enum.map(&String.capitalize/1)
1726-
end
17271711

1728-
defp has_matching_tech_stack?(user_stack, job_stack, contributions) do
1729-
matching_techs = get_matching_techs(user_stack, job_stack, contributions)
1730-
length(matching_techs) > 0
1712+
# Return the intersection
1713+
intersection =
1714+
all_user_techs
1715+
|> MapSet.intersection(job_set)
1716+
|> MapSet.to_list()
1717+
|> Enum.map(&String.capitalize/1)
1718+
1719+
if length(intersection) > 0 do
1720+
intersection
1721+
else
1722+
Enum.take(contribution_techs, 2)
1723+
end
17311724
end
17321725
end

0 commit comments

Comments
 (0)