<commit_before>defmodule ShiftplanerWebWeb.WeekendController do
  use ShiftplanerWebWeb, :controller

  alias Shiftplaner.{Event, Weekend}

  def index(conn, %{"event_id" => event_id}) do
    weekends = Weekend.list_weekends_for_event(event_id)
    render(conn, "index.html", weekends: weekends, event_id: event_id)
  end

  def new(conn, _params) do
    changeset = Weekend.change_weekend(%Weekend{})
    render(conn, "new.html", changeset: changeset)
  end

  def create(conn, %{"weekend" => weekend_params}) do
    case Weekend.create_weekend(weekend_params) do
      {:ok, weekend} ->
        conn
        |> put_flash(:info, "Weekend created successfully.")
        |> redirect(to: event_weekend_path(conn, :show, weekend))
      {:error, %Ecto.Changeset{} = changeset} ->
        render(conn, "new.html", changeset: changeset)
    end
  end

  def show(conn, %{"id" => id}) do
    weekend = Weekend.get_weekend!(id)
    render(conn, "show.html", weekend: weekend)
  end

  def edit(conn, %{"id" => id}) do
    weekend = Weekend.get_weekend!(id)
    changeset = Weekend.change_weekend(weekend)
    render(conn, "edit.html", weekend: weekend, changeset: changeset)
  end

  def update(conn, %{"id" => id, "weekend" => weekend_params}) do
    weekend = Weekend.get_weekend!(id)

    case Weekend.update_weekend(weekend, weekend_params) do
      {:ok, weekend} ->
        conn
        |> put_flash(:info, "Weekend updated successfully.")
        |> redirect(to: event_weekend_path(conn, :show, weekend))
      {:error, %Ecto.Changeset{} = changeset} ->
        render(conn, "edit.html", weekend: weekend, changeset: changeset)
    end
  end

  def delete(conn, %{"id" => id}) do
    weekend = Weekend.get_weekend!(id)
    {:ok, _weekend} = Weekend.delete_weekend(weekend)

    conn
    |> put_flash(:info, "Weekend deleted successfully.")
    |> redirect(to: event_weekend_path(conn, :index, weekend))<commit_msg>Changed usage of Shiftplaner.Weekend to Shiftplaner module.<commit_after>defmodule ShiftplanerWebWeb.WeekendController do
  use ShiftplanerWebWeb, :controller

  alias Shiftplaner.{Event, Weekend}

  def index(conn, %{"event_id" => event_id}) do
    weekends = Shiftplaner.list_weekends_for_event(event_id)
    render(conn, "index.html", weekends: weekends, event_id: event_id)
  end

  def new(conn, _params) do
    changeset = Shiftplaner.change_weekend(%Weekend{})
    render(conn, "new.html", changeset: changeset)
  end

  def create(conn, %{"weekend" => weekend_params}) do
    case Shiftplaner.create_weekend(weekend_params) do
      {:ok, weekend} ->
        conn
        |> put_flash(:info, "Weekend created successfully.")
        |> redirect(to: event_weekend_path(conn, :show, weekend))
      {:error, %Ecto.Changeset{} = changeset} ->
        render(conn, "new.html", changeset: changeset)
    end
  end

  def show(conn, %{"id" => id}) do
    weekend = Shiftplaner.get_weekend!(id)
    render(conn, "show.html", weekend: weekend)
  end

  def edit(conn, %{"id" => id}) do
    weekend = Shiftplaner.get_weekend!(id)
    changeset = Shiftplaner.change_weekend(weekend)
    render(conn, "edit.html", weekend: weekend, changeset: changeset)
  end

  def update(conn, %{"id" => id, "weekend" => weekend_params}) do
    weekend = Shiftplaner.get_weekend!(id)

    case Shiftplaner.update_weekend(weekend, weekend_params) do
      {:ok, weekend} ->
        conn
        |> put_flash(:info, "Weekend updated successfully.")
        |> redirect(to: event_weekend_path(conn, :show, weekend))
      {:error, %Ecto.Changeset{} = changeset} ->
        render(conn, "edit.html", weekend: weekend, changeset: changeset)
    end
  end

  def delete(conn, %{"id" => id}) do
    weekend = Shiftplaner.get_weekend!(id)
    {:ok, _weekend} = Shiftplaner.delete_weekend(weekend)

    conn
    |> put_flash(:info, "Weekend deleted successfully.")
    |> redirect(to: event_weekend_path(conn, :index, weekend))
{'fraction_non_alphanumeric': 0.13993871297242083, 'fraction_numerical': 0.0, 'mean_word_length': 3.8298397040690504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '2011257', 'n_tokens_mistral': 1356, 'n_tokens_neox': 1309, 'n_words': 293}