<commit_before>class ImagesController < ApplicationController

  def new
    # depending on the campaign id, selects the next condition in the sequences, which links to a different table
    # which has a presentation time, and an image id, which links to an image path (unique for each image +
    # distortion level)

    if session[:training] || session[:training].nil?
      @img = Image.find(-1)
      puts 'User shown training image: ' + @img.filepath.to_s
      return
    end

    @img_num = session[:img_num].to_i

    if @img_num < (session[:image_ids].length-1)
      if @img_num == 5 || @img_num == 19
        redirect_to content_path
      else
        session[:img_num] = @img_num + 1 #increment image id
      end
      #redirect_to show_path
    else
      redirect_to end_path
    end

    #if session[:img_num].to_i < session[:images].length
    @score = Score.new
    #set image to be shown
    @img = Image.find(session[:image_ids][@img_num].to_i)
    session[:view_time] = Viewtime.find(session[:view_time_ids][@img_num].to_i).viewtime

    puts 'User user_id: [' + session[:userid].to_s + ']'
    puts 'Viewing image_id: [' + session[:image_ids][@img_num].to_s+ '], image: [' +@img.filepath.to_s + ']'<commit_msg>Ensure training has view time<commit_after>class ImagesController < ApplicationController

  def new
    # depending on the campaign id, selects the next condition in the sequences, which links to a different table
    # which has a presentation time, and an image id, which links to an image path (unique for each image +
    # distortion level)

    if session[:training] || session[:training].nil?
      @img = Image.find(-1)
      session[:view_time] = 107
      puts 'User shown training image: ' + @img.filepath.to_s
      return
    end

    @img_num = session[:img_num].to_i

    if @img_num < (session[:image_ids].length-1)
      if @img_num == 5 || @img_num == 19
        redirect_to content_path
      else
        session[:img_num] = @img_num + 1 #increment image id
      end
      #redirect_to show_path
    else
      redirect_to end_path
    end

    #if session[:img_num].to_i < session[:images].length
    @score = Score.new
    #set image to be shown
    @img = Image.find(session[:image_ids][@img_num].to_i)
    session[:view_time] = Viewtime.find(session[:view_time_ids][@img_num].to_i).viewtime

    puts 'User user_id: [' + session[:userid].to_s + ']'
    puts 'Viewing image_id: [' + session[:image_ids][@img_num].to_s+ '], image: [' +@img.filepath.to_s + ']'
{'fraction_non_alphanumeric': 0.1199364575059571, 'fraction_numerical': 0.005957108816521049, 'mean_word_length': 3.2123745819397995, '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': '3729387', 'n_tokens_mistral': 829, 'n_tokens_neox': 798, 'n_words': 220}