<commit_before>class MirrorsController < ApplicationController

    def index
      #@face_ids = User.select { |u| u.face_id }
      @face_ids = {}
      @face_ids["face_info"] = []

      User.all.each do |u|
        @face_ids["face_info"] << {user_id: u.id, user_faceID: u.face_id}
        p @face_ids['face_info']
      end

      respond_to do |f|
        f.html { render json: @face_ids }
        f.js
      end
    end

    def show
      @mirror = Mirror.find(params[:id])
    end

    # def new
    #     @user = User.find_by_email(params[:email])
    #     if @user && @user.authenticate(params[:password])
    #       # Save the user id inside the browser cookie. This is how we keep the user 
    #       # logged in when they navigate around our website.
    #       session[:user_id] = @user.id
    #       redirect_to index
    #   end
    # end

    def edit
      @mirror = Mirror.find(params[:id])
    end

    def update
      @user = User.find(params[:user_id])
      @face_id = @user.face_id
      @mirror = Mirror.find(params[:id])

      @mirror.update(face_id: @face_id)
      
      redirect_to user_mirror_path(@user, @mirror)
    end

    def destroy
      @mirror = Mirror.find(params[:id])
      @mirror.face_id = nil
      respond_to do |format|
       format.html { render json: {response: 'success'} }
      end
    end

end<commit_msg>mirror face_id update set<commit_after>class MirrorsController < ApplicationController

    def index
      #@face_ids = User.select { |u| u.face_id }
      @face_ids = {}
      @face_ids["face_info"] = []

      User.all.each do |u|
        @face_ids["face_info"] << {user_id: u.id, user_faceID: u.face_id}
        p @face_ids['face_info']
      end

      respond_to do |f|
        f.html { render json: @face_ids }
        f.js
      end
    end

    def show
      @mirror = Mirror.find(params[:id])
    end

    # def new
    #     @user = User.find_by_email(params[:email])
    #     if @user && @user.authenticate(params[:password])
    #       # Save the user id inside the browser cookie. This is how we keep the user 
    #       # logged in when they navigate around our website.
    #       session[:user_id] = @user.id
    #       redirect_to index
    #   end
    # end

    def edit
      @mirror = Mirror.find(params[:id])
    end

    def update
      @user = User.find(params[:user_id])
      @face_id = @user.face_id
      @mirror = Mirror.find(params[:id])

      @mirror.update(face_id: @face_id)
      
      redirect_to user_mirror_path(@user, @mirror)
    end

    def destroy
      @mirror = Mirror.find(params[:id])
      @mirror.update(face_id: nil)
      respond_to do |format|
       format.html { render json: {response: 'success'} }
      end
    end

end
{'fraction_non_alphanumeric': 0.11841627315655648, 'fraction_numerical': 0.0, 'mean_word_length': 2.125993189557321, 'pattern_counts': {'":': 0, '<': 9, '<?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': '2348713', 'n_tokens_mistral': 946, 'n_tokens_neox': 915, 'n_words': 220}