<commit_before>#!/usr/bin/env ruby -wKU
require 'rubygems'
require 'mechanize'
require 'yaml'

config = YAML.load_file(File.dirname(__FILE__ + '/config.yaml'))

a = Mechanize.new
a.get(config['hip_url']) do |page|
  # Submit the login form
  dashboard = a.current_page.form_with(name: 'loginform') do |f|
  
  	f['asdf'] = config['user']
    f['fdsa'] = config['password']
  	
  end.submit

  dashboard   = a.click(dashboard.link_with(text: /fungsverwaltung/))
  dashboard   = a.click(dashboard.link_with(text: /Notenspiegel/))
  dashboard   = a.click(dashboard.link_with(text: /Abschluss: Bachelor/))
  grades_page = a.click(dashboard.link_with(text: /dualer Bachelor-Studiengang/))

  document      = Nokogiri::HTML(grades_page.content)
  all_modules   = document.xpath('//form/table[2]').search('tr')
  known_modules = File.read('module.txt', {encoding: "UTF-8"})

  all_modules.each do |line|
    status = line.at_xpath('td[5]/text()').to_s.strip
    
    if (status != "angemeldet")
      modul = line.at_xpath('td[2]/text()').to_s.strip
      unless (modul.empty? or known_modules.include?(modul))
        open('module.txt', 'a:UTF-8') do |file|
          file.puts modul
        end

        # Notify students
        ausgabe = "Neue Noten im HIP: " + modul<commit_msg>removes mechanize warnings and unused variables<commit_after>#!/usr/bin/env ruby -wKU
$VERBOSE = false

require 'rubygems'
require 'mechanize'
require 'yaml'

config = YAML.load_file(File.dirname(__FILE__ + '/config.yaml'))

a = Mechanize.new
a.get(config['hip_url']) do |page|
  # Submit the login form
  dashboard = a.current_page.form_with(name: 'loginform') do |f|

  	f['asdf'] = config['user']
    f['fdsa'] = config['password']

  end.submit

  dashboard   = a.click(dashboard.link_with(text: /fungsverwaltung/))
  dashboard   = a.click(dashboard.link_with(text: /Notenspiegel/))
  dashboard   = a.click(dashboard.link_with(text: /Abschluss: Bachelor/))
  grades_page = a.click(dashboard.link_with(text: /dualer Bachelor-Studiengang/))

  document      = Nokogiri::HTML(grades_page.content)
  all_modules   = document.xpath('//form/table[2]').search('tr')
  known_modules = File.read('module.txt', {encoding: "UTF-8"})

  all_modules.each do |line|
    status = line.at_xpath('td[5]/text()').to_s.strip

    if (status != "angemeldet")
      modul = line.at_xpath('td[2]/text()').to_s.strip
      unless (modul.empty? or known_modules.include?(modul))
        open('module.txt', 'a:UTF-8') do |file|
          file.puts modul
        end

{'fraction_non_alphanumeric': 0.16342721142403807, 'fraction_numerical': 0.003966679888932963, 'mean_word_length': 3.7855787476280836, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4160980', 'n_tokens_mistral': 943, 'n_tokens_neox': 935, 'n_words': 162}