<commit_before>class MeetingsController < ApplicationController
  before_action :set_meeting, only: %i[show edit update destroy]

  # GET /meetings/1
  # GET /meetings/1.json
  def show
    @meeting = Meeting.find(params[:id])
    @is_member = MeetingMember.where(meetingid: @meeting.id, userid: current_user.id).exists?

    @is_leader = MeetingMember.where(meetingid: @meeting.id, userid: current_user.id, leader: true).exists?

    if @is_leader
      @page_edit = edit_meeting_path(@meeting)
      @page_tooltip = t('meetings.edit_meeting')
    end

    @no_hide_page = false
    if hide_page(@meeting)
      respond_to do |format|
        format.html { redirect_to group_path(@meeting.groupid) }
        format.json { head :no_content }
      end
    else
      @comment = Comment.new
      @comments = Comment.where(commented_on: @meeting.id, comment_type: 'meeting').all.order('created_at DESC')
      @no_hide_page = true
    end
  end

  def comment
    @comment = Comment.new(comment_type: params[:comment_type], commented_on: params[:commented_on], comment_by: params[:comment_by], comment: params[:comment], visibility: 'all')

    unless @comment.save
      result = { no_save: true }
      respond_to do |format|
        format.html { render json: result }
        format.json { render json: result }<commit_msg>Add TODO about unclear code<commit_after>class MeetingsController < ApplicationController
  before_action :set_meeting, only: %i[show edit update destroy]

  # GET /meetings/1
  # GET /meetings/1.json
  def show
    @meeting = Meeting.find(params[:id])
    @is_member = MeetingMember.where(meetingid: @meeting.id, userid: current_user.id).exists?

    @is_leader = MeetingMember.where(meetingid: @meeting.id, userid: current_user.id, leader: true).exists?

    if @is_leader
      @page_edit = edit_meeting_path(@meeting)
      @page_tooltip = t('meetings.edit_meeting')
    end

    @no_hide_page = false
    if hide_page(@meeting)
      respond_to do |format|
        format.html { redirect_to group_path(@meeting.groupid) }
        format.json { head :no_content }
      end
    else
      @comment = Comment.new
      @comments = Comment.where(commented_on: @meeting.id, comment_type: 'meeting').all.order('created_at DESC')
      @no_hide_page = true
    end
  end

  def comment
    @comment = Comment.new(comment_type: params[:comment_type], commented_on: params[:commented_on], comment_by: params[:comment_by], comment: params[:comment], visibility: 'all')

    # TODO: it is quite unclear what the expected outcome is here. If nothing
    #       more should be done, then a return statement should be added. If
    #       the follow work should be performed, then the responce actions
    #       should be grouped at the end of the method
    unless @comment.save
      result = { no_save: true }
      respond_to do |format|
        format.html { render json: result }
        format.json { render json: result }
{'fraction_non_alphanumeric': 0.10538800406641817, 'fraction_numerical': 0.0013554727211114877, 'mean_word_length': 3.3994038748137108, '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': '5548553', 'n_tokens_mistral': 937, 'n_tokens_neox': 911, 'n_words': 234}