<commit_before>class ReportMarkerGUI < ReportMarker

	include GladeGUI

	def initialize
		@r1 = @r2 = false
    @a1 = @a2 = @a3 = @a4 = @a5 =@a5_2 = @a6 = @a6_2 = false
    @a7 = @a7_2 = false
    @s1 = @s2 = @s3 = false
    @d1 = @d2 = @d2_2 = @d3 = @d3_2 = @d4 = @d4_2 = @d5 = false
    @d5_2 = @d5_3 = @d6 = @d6_2 = @d7 = @d7_2 = false
    @d8 = @d8_2 = @d8_3 = @d9 = @d9_2 = @d9_3 = @d10 = false
    @d10_2 = @d10_3 = @d11 = @d11_2 = false
    @marker_name = nil
    @student_number = "Y"
	end

	def show()
		load_glade(__FILE__)  #loads file, glade/ReportMarkerGUI.glade into @builder
		set_glade_all(self) #populates glade controls with instance variables (i.e. Myclass.var1)
    
		show_window()
	end
  
	def buttonSave__clicked(button)
		get_glade_all() # get values of controls
    
    if ReportMarker.output_directory.nil?
      VR::Dialog.message_box("I don't know where to save the marksheets. Please tell me on the next screen.", title = "Marking Assistant")
      p ReportMarker.output_directory = VR::Dialog.folder_box(@builder)
    end

    if all_details_present?
      case @builder["notepad_parts"].page
      when 0
        if File.exists?(ReportMarker.marking_form_output_filename_part_one(@student_number))
          if VR::Dialog.ok_box("You've already completed part one for this student, continuing will overwrite it.", title = "Marking Assistant")
            save_part_one
          end
        else
          save_part_one
        end
      when 1
        if File.exists?(ReportMarker.marking_form_output_filename_part_two(@student_number))
          if VR::Dialog.ok_box("You've already completed part two for this student, continuing will overwrite it.", title = "Marking Assistant")
            save_part_two
          end
        else
          save_part_two
        end
      end
      if File.exists?("data/#{@student_number}_part1.json") && File.exists?("data/#{@student_number}_part2.json")
        ReportMarker.generate_complete(@student_number)
        VR::Dialog.message_box("Completed marksheets saved to: #{ReportMarker.output_directory}", title = "Marking Assistant")
      end
    end
	end
  
  def save_part_two
    details = part_two_details
    ReportMarker.generate_part_two(details)
    details[:input_filename] = ReportMarker.summary_input_filename
    details[:output_filename] = ReportMarker.summary_output_filename_part_two(part_one_details[:student_number])
    ReportMarker.generate_summary_part_two(details)
  end
  
  def part_two_details
    details = { :marker_name => @marker_name,
        :student_number => @student_number,
        :implementation => implementation_totalled,
        :code_listing => code_listing_totalled,
        :testing_and_verification => testing_and_verification_totalled,
        :user_manual => user_manual_totalled,
        :mcpi => mcpi_totalled,
        :input_filename => ReportMarker.marking_form_input_filename,
        :output_filename => ReportMarker.marking_form_output_filename_part_two(@student_number)
      }
  end
  
  def save_part_one
    details = part_one_details
    
    ReportMarker.generate_part_one(details)
    
    details[:input_filename] = ReportMarker.summary_input_filename
    details[:output_filename] = ReportMarker.summary_output_filename_part_one(part_one_details[:student_number])

    ReportMarker.generate_summary_part_one(details)
  end
  
  def part_one_details
    marks = part_one_marks
    details = {
      :marker_name => @marker_name,
      :student_number => @student_number,
      :requirements => marks[:requirements],
      :analysis => marks[:analysis],<commit_msg>Add confirmation message to partial saves<commit_after>class ReportMarkerGUI < ReportMarker

	include GladeGUI

	def initialize
		@r1 = @r2 = false
    @a1 = @a2 = @a3 = @a4 = @a5 =@a5_2 = @a6 = @a6_2 = false
    @a7 = @a7_2 = false
    @s1 = @s2 = @s3 = false
    @d1 = @d2 = @d2_2 = @d3 = @d3_2 = @d4 = @d4_2 = @d5 = false
    @d5_2 = @d5_3 = @d6 = @d6_2 = @d7 = @d7_2 = false
    @d8 = @d8_2 = @d8_3 = @d9 = @d9_2 = @d9_3 = @d10 = false
    @d10_2 = @d10_3 = @d11 = @d11_2 = false
    @marker_name = nil
    @student_number = "Y"
	end

	def show()
		load_glade(__FILE__)  #loads file, glade/ReportMarkerGUI.glade into @builder
		set_glade_all(self) #populates glade controls with instance variables (i.e. Myclass.var1)
    
		show_window()
	end
  
	def buttonSave__clicked(button)
		get_glade_all() # get values of controls
    
    if ReportMarker.output_directory.nil?
      VR::Dialog.message_box("I don't know where to save the marksheets. Please tell me on the next screen.", title = "Marking Assistant")
      ReportMarker.output_directory = VR::Dialog.folder_box(@builder)
    end

    if all_details_present?
      case @builder["notepad_parts"].page
      when 0
        if File.exists?(ReportMarker.marking_form_output_filename_part_one(@student_number))
          if VR::Dialog.ok_box("You've already completed part one for this student, continuing will overwrite it.", title = "Marking Assistant")
            save_part_one
          end
        else
          save_part_one
        end
      when 1
        if File.exists?(ReportMarker.marking_form_output_filename_part_two(@student_number))
          if VR::Dialog.ok_box("You've already completed part two for this student, continuing will overwrite it.", title = "Marking Assistant")
            save_part_two
          end
        else
          save_part_two
        end
      end
      if File.exists?("data/#{@student_number}_part1.json") && File.exists?("data/#{@student_number}_part2.json")
        ReportMarker.generate_complete(@student_number)
        VR::Dialog.message_box("Completed marksheets saved to: #{ReportMarker.output_directory}", title = "Marking Assistant")
      end
    end
	end
  
  def save_part_two
    details = part_two_details
    ReportMarker.generate_part_two(details)
    details[:input_filename] = ReportMarker.summary_input_filename
    details[:output_filename] = ReportMarker.summary_output_filename_part_two(part_one_details[:student_number])
    ReportMarker.generate_summary_part_two(details)
    VR::Dialog.message_box("Part 2 saved successfully", title = "Marking Assistant")
  end
  
  def part_two_details
    details = { :marker_name => @marker_name,
        :student_number => @student_number,
        :implementation => implementation_totalled,
        :code_listing => code_listing_totalled,
        :testing_and_verification => testing_and_verification_totalled,
        :user_manual => user_manual_totalled,
        :mcpi => mcpi_totalled,
        :input_filename => ReportMarker.marking_form_input_filename,
        :output_filename => ReportMarker.marking_form_output_filename_part_two(@student_number)
      }
  end
  
  def save_part_one
    details = part_one_details
    
    ReportMarker.generate_part_one(details)
    
    details[:input_filename] = ReportMarker.summary_input_filename
    details[:output_filename] = ReportMarker.summary_output_filename_part_one(part_one_details[:student_number])

    ReportMarker.generate_summary_part_one(details)
    VR::Dialog.message_box("Part 1 saved successfully", title = "Marking Assistant")
  end
  
  def part_one_details
    marks = part_one_marks
    details = {
      :marker_name => @marker_name,
      :student_number => @student_number,
      :requirements => marks[:requirements],
      :analysis => marks[:analysis],
{'fraction_non_alphanumeric': 0.0981081081081081, 'fraction_numerical': 0.018378378378378378, 'mean_word_length': 3.450390859891762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '1642276', 'n_tokens_mistral': 2439, 'n_tokens_neox': 2372, 'n_words': 491}