<commit_before>defmodule CoursePlanner.CourseHelper do
  @moduledoc """
  This module provides custom functionality for controller over the model
  """
  use CoursePlanner.Web, :model
  import Ecto.DateTime, only: [utc: 0]

  alias CoursePlanner.Repo
  alias CoursePlanner.Course

  def delete(course) do
    case course.status do
      "Planned" -> hard_delete_course(course)
      _         -> soft_delete_course(course)
    end
  end

  defp soft_delete_course(course) do
    changeset = change(course, %{deleted_at: utc()})
    Repo.update(changeset)
  end

  defp hard_delete_course(course) do
    Repo.delete!(course)
  end

  def all_none_deleted() do
    query = from c in Course , where: is_nil(c.deleted_at)
    Repo.all(query)
  end
end<commit_msg>Fixes credo suggestion<commit_after>defmodule CoursePlanner.CourseHelper do
  @moduledoc """
  This module provides custom functionality for controller over the model
  """
  use CoursePlanner.Web, :model
  import Ecto.DateTime, only: [utc: 0]

  alias CoursePlanner.Repo
  alias CoursePlanner.Course

  def delete(course) do
    case course.status do
      "Planned" -> hard_delete_course(course)
      _         -> soft_delete_course(course)
    end
  end

  defp soft_delete_course(course) do
    changeset = change(course, %{deleted_at: utc()})
    Repo.update(changeset)
  end

  defp hard_delete_course(course) do
    Repo.delete!(course)
  end

  def all_none_deleted do
    query = from c in Course , where: is_nil(c.deleted_at)
    Repo.all(query)
  end
end
{'fraction_non_alphanumeric': 0.08655737704918033, 'fraction_numerical': 0.0013114754098360656, 'mean_word_length': 3.555223880597015, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3610471', 'n_tokens_mistral': 516, 'n_tokens_neox': 503, 'n_words': 129}