<commit_before>require 'lib/repo/repository_factory'

class SubmissionsController < ApplicationController
  include SubmissionsHelper
  
  before_filter    :authorize_only_for_admin, :except => [:browse,
  :index, :file_manager, :update_files, :hand_in]
  before_filter    :authorize_for_ta_and_admin, :only => [:browse, :index]
 
 def file_manager
   @assignment = Assignment.find(params[:id])
   @grouping = current_user.accepted_grouping_for(@assignment.id)
   user_group = @grouping.group
   revision_number= params[:revision_number]
   path = params[:path] || '/'
   repo = Repository.create(REPOSITORY_TYPE).open(File.join(REPOSITORY_STORAGE,
   user_group.repository_name))
   if revision_number.nil?
     @revision = repo.get_latest_revision
   else
     @revision = repo.get_revision(revision_number.to_i)
   end
   @directories = @revision.directories_at_path(File.join(@assignment.repository_folder, path))
   @files = @revision.files_at_path(File.join(@assignment.repository_folder, path))

   @missing_assignment_files = []
   @assignment.assignment_files.each do |assignment_file|
     if !@revision.path_exist?(File.join(@assignment.repository_folder,
     assignment_file.filename))
       @missing_assignment_files.push(assignment_file)
     end
   end
 end
  


  def browse
    @assignment = Assignment.find(params[:id])
    # If the current user is a TA, then we need to get the Groupings
    # that are assigned for them to mark.  If they're an Admin, then
    # we need to give them a list of all Groupings for this Assignment.
    if current_user.ta?
      @groupings = []
      @assignment.ta_memberships.find_all_by_user_id(current_user.id).each do |membership|
        @groupings.push(membership.grouping)
      end
      render :action => 'ta_browse'
      return
    end<commit_msg>- fix typo: its 'path_exists?' not 'path_exest'<commit_after>require 'lib/repo/repository_factory'

class SubmissionsController < ApplicationController
  include SubmissionsHelper
  
  before_filter    :authorize_only_for_admin, :except => [:browse,
  :index, :file_manager, :update_files, :hand_in]
  before_filter    :authorize_for_ta_and_admin, :only => [:browse, :index]
 
 def file_manager
   @assignment = Assignment.find(params[:id])
   @grouping = current_user.accepted_grouping_for(@assignment.id)
   user_group = @grouping.group
   revision_number= params[:revision_number]
   path = params[:path] || '/'
   repo = Repository.create(REPOSITORY_TYPE).open(File.join(REPOSITORY_STORAGE,
   user_group.repository_name))
   if revision_number.nil?
     @revision = repo.get_latest_revision
   else
     @revision = repo.get_revision(revision_number.to_i)
   end
   @directories = @revision.directories_at_path(File.join(@assignment.repository_folder, path))
   @files = @revision.files_at_path(File.join(@assignment.repository_folder, path))

   @missing_assignment_files = []
   @assignment.assignment_files.each do |assignment_file|
     if !@revision.path_exists?(File.join(@assignment.repository_folder,
     assignment_file.filename))
       @missing_assignment_files.push(assignment_file)
     end
   end
 end
  


  def browse
    @assignment = Assignment.find(params[:id])
    # If the current user is a TA, then we need to get the Groupings
    # that are assigned for them to mark.  If they're an Admin, then
    # we need to give them a list of all Groupings for this Assignment.
    if current_user.ta?
      @groupings = []
      @assignment.ta_memberships.find_all_by_user_id(current_user.id).each do |membership|
        @groupings.push(membership.grouping)
      end
      render :action => 'ta_browse'
      return
    end
{'fraction_non_alphanumeric': 0.09986320109439124, 'fraction_numerical': 0.0, 'mean_word_length': 4.222857142857142, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7236766', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1190, 'n_words': 237}