@@ -602,13 +602,11 @@ defmodule AlgoraWeb.Org.JobLive do
602602 # Get total matches count first (efficient query)
603603 total_matches_count = Settings . get_job_matches_count ( socket . assigns . job )
604604
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 )
609607
610608 developers =
611- limited_matches
609+ all_matches
612610 |> Enum . concat ( all_applicants )
613611 |> Enum . map ( & & 1 . user )
614612
@@ -621,15 +619,28 @@ defmodule AlgoraWeb.Org.JobLive do
621619 |> AlgoraCloud.Profiles . list_heatmaps ( )
622620 |> Map . new ( fn heatmap -> { heatmap . user_id , heatmap . data } end )
623621
624- # Trigger async sync for missing heatmaps if connected
622+ # Trigger async sync for missing heatmaps if connected (for all 12 matches)
625623 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 ) )
627626
628627 if length ( missing_heatmap_users ) > 0 do
629628 enqueue_heatmap_sync ( missing_heatmap_users )
630629 end
631630 end
632631
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+
633644 # Create a fake matches list with the right count for UI compatibility
634645 fake_matches = List . duplicate ( % { } , total_matches_count )
635646
@@ -859,7 +870,7 @@ defmodule AlgoraWeb.Org.JobLive do
859870 < div class = "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 " >
860871 < div class = "flex items-center gap-4 " >
861872 <%= 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 >
863874 <% else %>
864875 < . link navigate = { User . url ( @ user ) } >
865876 < . avatar class = "h-12 w-12 rounded-full " >
@@ -893,11 +904,11 @@ defmodule AlgoraWeb.Org.JobLive do
893904 <% end %>
894905 </ div >
895906 < div
896- :if = { @ user . provider_meta && not @ anonymized }
907+ :if = { @ user . provider_meta }
897908 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 "
898909 >
899910 < . link
900- :if = { @ user . provider_login }
911+ :if = { @ user . provider_login && not @ anonymized }
901912 href = { "https://github.com/#{ @ user . provider_login } " }
902913 target = "_blank "
903914 class = "flex items-center gap-1 hover:underline "
@@ -961,7 +972,12 @@ defmodule AlgoraWeb.Org.JobLive do
961972 < div class = "flex flex-col gap-3 mt-2 " >
962973 <%= for { owner , contributions } <- aggregate_contributions ( @ contributions ) |> Enum . take ( 3 ) do %>
963974 < . 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+ }
965981 target = "_blank "
966982 rel = "noopener "
967983 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