<commit_before>module Manage
  class PresentationsController < ApplicationController
    before_action :authenticate_user!

    def index
      @presentations = current_user.presentations.preload(:user)
      render "presentations/index"
    end

    def create
      presentation = current_user.presentations.create(create_presentation_params)
      Ppt2pdfJob.perform_later(presentation)
      redirect_to edit_manage_presentation_path(presentation)
    end

    def edit
      @presentation = current_user.presentations.find(params[:id])
    end

    def update
      @presentation = current_user.presentations.find(params[:id])
      if @presentation.update(update_presentation_params)
        redirect_to manage_presentations_path
      else
        render :edit
      end
    end

    private

      def create_presentation_params
        # FIXIME: params 書き換えるのがイマイチ
        title = File.basename(params[:presentation][:original_file].original_filename, ".*")
        params[:presentation][:title] = title
        params.require(:presentation).permit(:title, :original_file)
      end

      def update_presentation_params
        params.require(:presentation).permit(:title, :is_public)
      end
  end<commit_msg>投稿時に現在時間を入れる<commit_after>module Manage
  class PresentationsController < ApplicationController
    before_action :authenticate_user!

    def index
      @presentations = current_user.presentations.preload(:user)
      render "presentations/index"
    end

    def create
      presentation = current_user.presentations.create(create_presentation_params)
      Ppt2pdfJob.perform_later(presentation)
      redirect_to edit_manage_presentation_path(presentation)
    end

    def edit
      @presentation = current_user.presentations.find(params[:id])
    end

    def update
      @presentation = current_user.presentations.find(params[:id])
      if @presentation.update(update_presentation_params)
        redirect_to manage_presentations_path
      else
        render :edit
      end
    end

    private

      def create_presentation_params
        # FIXIME: params 書き換えるのがイマイチ
        title = File.basename(params[:presentation][:original_file].original_filename, ".*")
        params[:presentation][:title] = title
        params[:presentation][:published_at] = Time.current
        params.require(:presentation).permit(:title, :original_file, :published_at)
      end

      def update_presentation_params
        params.require(:presentation).permit(:title, :is_public)
      end
  end
{'fraction_non_alphanumeric': 0.07863383637807785, 'fraction_numerical': 0.0007942811755361397, 'mean_word_length': 3.450530035335689, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3132384', 'n_tokens_mistral': 731, 'n_tokens_neox': 685, 'n_words': 120}