<commit_before>class AssignmentController < ApplicationController
  require 'ftools'
  auto_complete_for :user, :name
  before_filter :authorize
  
  @no_dl="1" # a value of "no" for whether an action is permitted prior to a deadline
  @late_dl="2" # a value of "late" for whether an action is permitted prior to a deadline (it is permitted, but marked late)
  @ok_dl="3" # a value of "OK" for whether an action is permitted prior to a deadline
  def new
    @assignment = Assignment.new
    @questionnaire = Questionnaire.find_all
    @wiki_types = WikiType.find_all
  end
  def add_team_member
    @count=4#params[:newitem]
  end
  def create
    # The Assignment Directory field to be filled in is the path relative to the instructor's home directory (named after his user.name)
    # However, when an administrator creates an assignment, (s)he needs to preface the path with the user.name of the instructor whose assignment it is.
    @assignment = Assignment.new(params[:assignment])
    @assignment.instructor_id = (session[:user]).id
    @assignment.submitter_count = 0
    ## feedback added
    puts "round = ",params[:assignment_helper][:no_of_reviews].to_i
    ##
    @duedate=DueDate.new
    
    # Deadline types used in the deadline_types DB table
    @Submission_deadline=1;
    @Review_deadline=2;
    @Resubmission_deadline=3;
    @Rereview_deadline=4;
    @Review_of_review_deadline=5;
    
    
    if @assignment.save
      submit_duedate=DueDate.new(params[:submit_deadline]);
      submit_duedate.deadline_type_id=@Submission_deadline;
      submit_duedate.assignment_id=@assignment.id;
      submit_duedate.late_policy_id=params[:for_due_date][:late_policy_id];
      ## feedback added
      submit_duedate.round = 1;
      puts "submit round",submit_duedate.round
      ##
      submit_duedate.save;
      
      review_duedate=DueDate.new(params[:review_deadline]);
      review_duedate.deadline_type_id=@Review_deadline;
      review_duedate.assignment_id=@<EMAIL>;
      review_duedate.late_policy_id=1;
      ## feedback added
      review_duedate.round = 1;
      puts "review round",review_duedate.round
      ##
      review_duedate.save;
      ## feedback added
      max_round = 2;
      ##
      
      if params[:assignment_helper][:no_of_reviews].to_i >= 2
        for resubmit_duedate_key in params[:additional_submit_deadline].keys
          resubmit_duedate=DueDate.new(params[:additional_submit_deadline][resubmit_duedate_key]);
          resubmit_duedate.deadline_type_id=@Resubmission_deadline;
          resubmit_duedate.assignment_id=@<EMAIL>;
          resubmit_duedate.late_policy_id=params[:for_due_date][:late_policy_id];
          ## feedback added
          resubmit_duedate.round = max_round
          puts "resubmit round",resubmit_duedate.round
          max_round = max_round + 1
          ##
          resubmit_duedate.save;
        end
        ## feedback added
        max_round = 2
        ##
        for rereview_duedate_key in params[:additional_review_deadline].keys
          rereview_duedate=DueDate.new(params[:additional_review_deadline][rereview_duedate_key]);
          rereview_duedate.deadline_type_id=@Rereview_deadline;
          rereview_duedate.assignment_id=<EMAIL>;
          rereview_duedate.late_policy_id=params[:for_due_date][:late_policy_id];
          ## feedback added
          rereview_duedate.round = max_round
          puts "rereview round",rereview_duedate.round
          max_round = max_round + 1
          ##
          rereview_duedate.save;
        end
        ## feedback added
        puts "max_round ", max_round
        ##
        
      end      
      reviewofreview_duedate=DueDate.new(params[:reviewofreview_deadline]);
      reviewofreview_duedate.deadline_type_id=@Review_of_review_deadline;
      reviewofreview_duedate.assignment_id=@assignment.id;
      reviewofreview_duedate.late_policy_id=params[:for_due_date][:late_policy_id];
      ## feedback added
      reviewofreview_duedate.round = max_round<commit_msg>Commented out late policy variable assignments in controller. The parameter to which these lines referred to was removed from the view, but were still referenced in this controller.<commit_after>class AssignmentController < ApplicationController
  require 'ftools'
  auto_complete_for :user, :name
  before_filter :authorize
  
  @no_dl="1" # a value of "no" for whether an action is permitted prior to a deadline
  @late_dl="2" # a value of "late" for whether an action is permitted prior to a deadline (it is permitted, but marked late)
  @ok_dl="3" # a value of "OK" for whether an action is permitted prior to a deadline
  def new
    @assignment = Assignment.new
    @questionnaire = Questionnaire.find_all
    @wiki_types = WikiType.find_all
  end
  def add_team_member
    @count=4#params[:newitem]
  end
  def create
    # The Assignment Directory field to be filled in is the path relative to the instructor's home directory (named after his user.name)
    # However, when an administrator creates an assignment, (s)he needs to preface the path with the user.name of the instructor whose assignment it is.
    @assignment = Assignment.new(params[:assignment])
    @assignment.instructor_id = (session[:user]).id
    @assignment.submitter_count = 0
    ## feedback added
    puts "round = ",params[:assignment_helper][:no_of_reviews].to_i
    ##
    @duedate=DueDate.new
    
    # Deadline types used in the deadline_types DB table
    @Submission_deadline=1;
    @Review_deadline=2;
    @Resubmission_deadline=3;
    @Rereview_deadline=4;
    @Review_of_review_deadline=5;
    
    
    if @assignment.save
      submit_duedate=DueDate.new(params[:submit_deadline]);
      submit_duedate.deadline_type_id=@Submission_deadline;
      submit_duedate.assignment_id=@<EMAIL>;
      # ajbudlon 5/28/2008 commented out late policy
      #submit_duedate.late_policy_id=params[:for_due_date][:late_policy_id];      
      ## feedback added
      submit_duedate.round = 1;
      puts "submit round",submit_duedate.round
      ##
      submit_duedate.save;
      
      review_duedate=DueDate.new(params[:review_deadline]);
      review_duedate.deadline_type_id=@Review_deadline;
      review_duedate.assignment_id=<EMAIL>;
      review_duedate.late_policy_id=1;
      ## feedback added
      review_duedate.round = 1;
      puts "review round",review_duedate.round
      ##
      review_duedate.save;
      ## feedback added
      max_round = 2;
      ##
      
      if params[:assignment_helper][:no_of_reviews].to_i >= 2
        for resubmit_duedate_key in params[:additional_submit_deadline].keys
          resubmit_duedate=DueDate.new(params[:additional_submit_deadline][resubmit_duedate_key]);
          resubmit_duedate.deadline_type_id=@Resubmission_deadline;
          resubmit_duedate.assignment_id=<EMAIL>;
          # ajbudlon 5/28/2008 commented out late policy
          #resubmit_duedate.late_policy_id=params[:for_due_date][:late_policy_id];
          ## feedback added
          resubmit_duedate.round = max_round
          puts "resubmit round",resubmit_duedate.round
          max_round = max_round + 1
          ##
          resubmit_duedate.save;
        end
        ## feedback added
        max_round = 2
        ##
        for rereview_duedate_key in params[:additional_review_deadline].keys
          rereview_duedate=DueDate.new(params[:additional_review_deadline][rereview_duedate_key]);
          rereview_duedate.deadline_type_id=@Rereview_deadline;
          rereview_duedate.assignment_id=<EMAIL>;
          # ajbudlon 5/28/2008 commented out late policy
          #rereview_duedate.late_policy_id=params[:for_due_date][:late_policy_id];
          ## feedback added
          rereview_duedate.round = max_round
          puts "rereview round",rereview_duedate.round
          max_round = max_round + 1
          ##
          rereview_duedate.save;
        end
        ## feedback added
        puts "max_round ", max_round
        ##
        
      end      
      reviewofreview_duedate=DueDate.new(params[:reviewofreview_deadline]);
      reviewofreview_duedate.deadline_type_id=@Review_of_review_deadline;
      reviewofreview_duedate.assignment_id=<EMAIL>;
      # ajbudlon 5/28/2008 commented out late policy
      #reviewofreview_duedate.late_policy_id=params[:for_due_date][:late_policy_id];
      ## feedback added
      reviewofreview_duedate.round = max_round
{'fraction_non_alphanumeric': 0.0829077087540088, 'fraction_numerical': 0.007601852951656966, 'mean_word_length': 3.2784552845528454, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '5311664', 'n_tokens_mistral': 2778, 'n_tokens_neox': 2698, 'n_words': 522}