<commit_before>class StaticController < ApplicationController
  def homepage
    @projects = Project.includes(:labels).active.limit(200).sample(6)
    @featured_projects = Project.includes(:labels).featured.limit(200).sample(6)
    @users = User.order('pull_requests_count desc').limit(200).sample(24)
    @orgs = Organisation.order_by_pull_requests.limit(200).sample(24)
    @pull_requests = PullRequest.year(current_year).order('created_at desc').limit(5)
  end

  def about
    @contributors = User.contributors

    # a user's location is pulled from public GitHub data
    # available on their profile when authenticating with the site
    @map_markers = Rails.cache.fetch 'contributors-map-markers', expires_in: 24.hours do
      [].tap do |markers|
        active_users.each do |user, marker|<commit_msg>More efficient loading of projects on homepage<commit_after>class StaticController < ApplicationController
  def homepage
    @projects = Project.includes(:labels).active.order("RANDOM()").limit(6)
    @featured_projects = Project.includes(:labels).featured.order("RANDOM()").limit(6)
    @users = User.order('pull_requests_count desc').limit(200).sample(24)
    @orgs = Organisation.order_by_pull_requests.limit(200).sample(24)
    @pull_requests = PullRequest.year(current_year).order('created_at desc').limit(5)
  end

  def about
    @contributors = User.contributors

    # a user's location is pulled from public GitHub data
    # available on their profile when authenticating with the site
    @map_markers = Rails.cache.fetch 'contributors-map-markers', expires_in: 24.hours do
      [].tap do |markers|
        active_users.each do |user, marker|
{'fraction_non_alphanumeric': 0.11397720455908818, 'fraction_numerical': 0.021595680863827234, 'mean_word_length': 4.616161616161616, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4921267', 'n_tokens_mistral': 530, 'n_tokens_neox': 481, 'n_words': 111}