@@ -602,13 +602,11 @@ defmodule AlgoraWeb.Org.JobLive do
602
602
# Get total matches count first (efficient query)
603
603
total_matches_count = Settings . get_job_matches_count ( socket . assigns . job )
604
604
605
- # Load only the matches we need to display (limit to 9)
606
- limited_matches = Settings . get_job_matches ( socket . assigns . job , limit: 9 )
607
-
608
- truncated_matches = AlgoraCloud . truncate_matches ( socket . assigns . current_org , limited_matches )
605
+ # Load 12 matches for sorting by contributions
606
+ all_matches = Settings . get_job_matches ( socket . assigns . job , limit: 12 )
609
607
610
608
developers =
611
- limited_matches
609
+ all_matches
612
610
|> Enum . concat ( all_applicants )
613
611
|> Enum . map ( & & 1 . user )
614
612
@@ -621,15 +619,28 @@ defmodule AlgoraWeb.Org.JobLive do
621
619
|> AlgoraCloud.Profiles . list_heatmaps ( )
622
620
|> Map . new ( fn heatmap -> { heatmap . user_id , heatmap . data } end )
623
621
624
- # Trigger async sync for missing heatmaps if connected
622
+ # Trigger async sync for missing heatmaps if connected (for all 12 matches)
625
623
if connected? ( socket ) do
626
- missing_heatmap_users = Enum . reject ( developers , & Map . has_key? ( heatmaps_map , & 1 . id ) )
624
+ all_match_users = Enum . map ( all_matches , & & 1 . user )
625
+ missing_heatmap_users = Enum . reject ( all_match_users , & Map . has_key? ( heatmaps_map , & 1 . id ) )
627
626
628
627
if length ( missing_heatmap_users ) > 0 do
629
628
enqueue_heatmap_sync ( missing_heatmap_users )
630
629
end
631
630
end
632
631
632
+ # Sort matches by total contributions (0 if no heatmap) and take top 6
633
+ sorted_matches =
634
+ all_matches
635
+ |> Enum . sort_by ( fn match ->
636
+ heatmap_data = Map . get ( heatmaps_map , match . user . id )
637
+ total_contributions = if heatmap_data , do: get_in ( heatmap_data , [ "totalContributions" ] ) || 0 , else: 0
638
+ - total_contributions # negative for descending sort
639
+ end )
640
+ |> Enum . take ( 6 )
641
+
642
+ truncated_matches = AlgoraCloud . truncate_matches ( socket . assigns . current_org , sorted_matches )
643
+
633
644
# Create a fake matches list with the right count for UI compatibility
634
645
fake_matches = List . duplicate ( % { } , total_matches_count )
635
646
@@ -859,7 +870,7 @@ defmodule AlgoraWeb.Org.JobLive do
859
870
< div class = "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 " >
860
871
< div class = "flex items-center gap-4 " >
861
872
<%= if @ anonymized do %>
862
- < div class = "h-12 w-12 rounded-full bg-muted " > </ div >
873
+ < div class = "h-12 w-12 rounded-full bg-muted blur-sm " > </ div >
863
874
<% else %>
864
875
< . link navigate = { User . url ( @ user ) } >
865
876
< . avatar class = "h-12 w-12 rounded-full " >
@@ -893,11 +904,11 @@ defmodule AlgoraWeb.Org.JobLive do
893
904
<% end %>
894
905
</ div >
895
906
< div
896
- :if = { @ user . provider_meta && not @ anonymized }
907
+ :if = { @ user . provider_meta }
897
908
class = "pt-0.5 flex items-center gap-x-2 gap-y-1 text-xs text-muted-foreground max-w-[250px] 2xl:max-w-none truncate "
898
909
>
899
910
< . link
900
- :if = { @ user . provider_login }
911
+ :if = { @ user . provider_login && not @ anonymized }
901
912
href = { "https://github.com/#{ @ user . provider_login } " }
902
913
target = "_blank "
903
914
class = "flex items-center gap-1 hover:underline "
@@ -961,7 +972,12 @@ defmodule AlgoraWeb.Org.JobLive do
961
972
< div class = "flex flex-col gap-3 mt-2 " >
962
973
<%= for { owner , contributions } <- aggregate_contributions ( @ contributions ) |> Enum . take ( 3 ) do %>
963
974
< . maybe_link
964
- href = { if @ anonymized , do: nil , else: "https://github.com/#{ owner . provider_login } /#{ List . first ( contributions ) . repository . name } /pulls?q=author%3A#{ @ user . provider_login } +is%3Amerged+" }
975
+ href = {
976
+ if @ anonymized ,
977
+ do: nil ,
978
+ else:
979
+ "https://github.com/#{ owner . provider_login } /#{ List . first ( contributions ) . repository . name } /pulls?q=author%3A#{ @ user . provider_login } +is%3Amerged+"
980
+ }
965
981
target = "_blank "
966
982
rel = "noopener "
967
983
class = "flex items-center gap-3 rounded-xl pr-2 bg-card/50 border border-border/50 hover:border-border transition-all "
0 commit comments