<commit_before>defmodule Ello.Core.Contest do
  import Ecto.Query
  alias Ello.Core.Repo
  alias __MODULE__.{
    ArtistInvite,
    ArtistInviteSubmission,
    Preload,
  }

  def artist_invite(%{id_or_slug: id_or_slug, preview: "true", current_user: %{is_staff: true}} = options) do
    ArtistInvite
    |> Repo.get_by_id_or_slug(id_or_slug: id_or_slug)
    |> Preload.artist_invites(options)
  end
  def artist_invite(%{id_or_slug: id_or_slug, preview: "true", current_user: %{id: current_user_id}} = options) do
    ArtistInvite
    |> where([ai], ai.brand_account_id == ^current_user_id or ai.status != "preview")
    |> Repo.get_by_id_or_slug(id_or_slug: id_or_slug)
    |> Preload.artist_invites(options)
  end
  def artist_invite(%{id_or_slug: id_or_slug} = options) do
    ArtistInvite
    |> where([ai], ai.status != "preview")
    |> Repo.get_by_id_or_slug(id_or_slug: id_or_slug)
    |> Preload.artist_invites(options)
  end

  def artist_invites(%{page: page, per_page: per_page, preview: "true", current_user: %{is_staff: true}} = options) do
    offset = per_page * (page - 1)

    ArtistInvite
    |> order_by(desc: :created_at)
    |> limit(^per_page)
    |> offset(^offset)
    |> Repo.all
    |> Preload.artist_invites(options)
  end
  def artist_invites(%{page: page, per_page: per_page, preview: "true", current_user: %{id: current_user_id}} = options) do
    offset = per_page * (page - 1)

    ArtistInvite
    |> where([ai], ai.brand_account_id == ^current_user_id or ai.status != "preview")
    |> order_by(desc: :created_at)
    |> limit(^per_page)
    |> offset(^offset)
    |> Repo.all
    |> Preload.artist_invites(options)
  end
  def artist_invites(%{for_discovery: true} = options) do
    ArtistInvite
    |> where([ai], ai.status == "open")
    |> Repo.all<commit_msg>Fix compilation warning.<commit_after>defmodule Ello.Core.Contest do
  import Ecto.Query
  alias Ello.Core.Repo
  alias __MODULE__.{
    ArtistInvite,
    ArtistInviteSubmission,
    Preload,
  }

  def artist_invite(%{id_or_slug: id_or_slug, preview: "true", current_user: %{is_staff: true}} = options) do
    ArtistInvite
    |> Repo.get_by_id_or_slug(id_or_slug: id_or_slug)
    |> Preload.artist_invites(options)
  end
  def artist_invite(%{id_or_slug: id_or_slug, preview: "true", current_user: %{id: current_user_id}} = options) do
    ArtistInvite
    |> where([ai], ai.brand_account_id == ^current_user_id or ai.status != "preview")
    |> Repo.get_by_id_or_slug(id_or_slug: id_or_slug)
    |> Preload.artist_invites(options)
  end
  def artist_invite(%{id_or_slug: id_or_slug} = options) do
    ArtistInvite
    |> where([ai], ai.status != "preview")
    |> Repo.get_by_id_or_slug(id_or_slug: id_or_slug)
    |> Preload.artist_invites(options)
  end

  def artist_invites(%{page: page, per_page: per_page, preview: "true", current_user: %{is_staff: true}} = options) do
    offset = per_page * (page - 1)

    ArtistInvite
    |> order_by(desc: :created_at)
    |> limit(^per_page)
    |> offset(^offset)
    |> Repo.all
    |> Preload.artist_invites(options)
  end
  def artist_invites(%{page: page, per_page: per_page, preview: "true", current_user: %{id: current_user_id}} = options) do
    offset = per_page * (page - 1)

    ArtistInvite
    |> where([ai], ai.brand_account_id == ^current_user_id or ai.status != "preview")
    |> order_by(desc: :created_at)
    |> limit(^per_page)
    |> offset(^offset)
    |> Repo.all
    |> Preload.artist_invites(options)
  end
  def artist_invites(%{for_discovery: true}) do
    ArtistInvite
    |> where([ai], ai.status == "open")
    |> Repo.all
{'fraction_non_alphanumeric': 0.13885031935573452, 'fraction_numerical': 0.0011108025548458762, 'mean_word_length': 4.1164772727272725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3298179', 'n_tokens_mistral': 1408, 'n_tokens_neox': 1391, 'n_words': 250}