Class: Studium::DetermineCurricula

Inherits:
Base
  • Object
show all
Defined in:
lib/studium/curricula/determine_curricula/misc.rb,
lib/studium/curricula/determine_curricula/run.rb,
lib/studium/curricula/determine_curricula/help.rb,
lib/studium/curricula/determine_curricula/menu.rb,
lib/studium/curricula/determine_curricula/reset.rb,
lib/studium/curricula/determine_curricula/report.rb,
lib/studium/curricula/determine_curricula/constants.rb,
lib/studium/curricula/determine_curricula/initialize.rb,
lib/studium/curricula/determine_curricula/determine_curricula.rb

Overview

Studium::DetermineCurricula

Constant Summary

Constants inherited from Base

Base::COMMON_YEAR_DAYS_IN_MONTH, Base::LEFT_PADDING, Base::NAMESPACE, Base::N_CHARACTERS_PER_LINE

Constants included from Colours

Colours::COLOURS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add_proper_year_entry_to_this_line, #already_solved_this_lva_number?, #append_what_into, #available_topics_as_short_name, #average_grade, #bachelor_master_or_diploma, #be_silent, #be_verbose?, #beautiful_url, #change_directory, #cheering_person, #chmod, #cliner, #colour_for_ects_points, #colourize_percentage, #convert_this_array_of_lectures_into_the_full_dataset, #copy, #course_filter, #cpruby, #create_directory, #create_file, #csv_file?, #current_month?, #current_semester?, #dataset?, #datum?, #day_month_year, #debug?, #delete_file, #directory_of_the_exam_topics?, #directory_to_my_exam_topics, #directory_to_the_exam_topics?, #disable_colours, #disable_colours_globally, #do_not_be_verbose, #do_not_use_opn, #do_these_curricula_include_both_a_bachelor_and_a_master_curriculum?, #does_this_line_include_a_german_weekday?, #does_this_line_include_a_html_colour?, #does_this_line_include_an_english_weekday?, #does_this_line_start_with_a_german_weekday?, #e, #ecomment, #editor?, #ee, #egrey, #enable_colours, #enable_colours_globally, #enable_debug, #encoding?, #english_to_german_weekday, #ensure_that_a_base_directory_exists_for_this_file, #ensure_that_the_log_directory_exists, #eparse, #esystem, #etomato, #exit_program, #extract_dd_mm_yyyy, #fetch_this_curriculum, #file_important_exams?, #file_lecture_information?, #file_passed_exams_per_month, #file_read_with_proper_encoding, #filter_away_already_answered_questions, #filter_away_invalid_questions, #filter_for_all_passed_exams, #find_corresponding_exam_topic, #from_curriculum_id_to_university, #german_date_notation, #german_weekday?, #german_weekdays?, #german_weekend_for?, #german_yes_or_no, #has_a_bachelor_and_a_master_curriculum?, #has_a_bachelor_curriculum?, #has_a_master_curriculum?, #has_lva_dates_registered?, #has_this_exam_topic_been_solved?, #has_year_entry?, #hh_mm_ss_dd_mm_yyyy, #horizontal_bar?, #html_log_directory?, #infer_the_namespace, #initialize_the_internal_hash, #internal_hash?, #is_a_master_lecture?, #is_a_registered_curriculum?, #is_a_weekday?, #is_connected_to_the_www?, #is_german_weekday?, #is_on_roebe?, #is_prüfungsimmanent?, #is_this_a_registered_exam_topic?, #is_this_a_valid_html_colour?, #is_this_day_today?, #is_this_lecture_a_practical_course?, #konsole_support?, #last_file?, #lectures_from_indi1, #lectures_from_indi2, #lectures_from_indi3, #lectures_from_indi4, #lectures_from_the_bachelor_genetik_curriculum, #lectures_from_the_individual_vektor_curricula, #left_arrow?, #load_yaml_dataset, #map_input_to_this_curriculum_filename, #move_file, #n_days_difference_from_today_to_this_day, #n_seconds_to_n_days, #namespace?, #no_ext_name, #no_file_exists_at, #number_to_month, #obtain, #obtain_lectures_from_this_curriculum, #open_in_browser, #open_in_editor, #opne, #opnerev, #opnn, #padded_current_month?, #parse_dd_mm_yyyy, #parse_this_line_for_date_entry, #path_to_exam_topic?, #project_yaml_directory?, #rds, #read_dataset_from_a_curriculum_file, #read_in_exam_dataset_from_this_file, #read_this_file_with_default_encoding, #readlines_from_this_input_file, #register_sigint, #remove_empty_strings, #remove_escape_sequences, #remove_internal_comments, #remove_leading_comments, #remove_leading_weekday_names_from, #remove_newlines, #remove_tags_from_this_input, #rename_kde_konsole_tab, #rename_konsole_tab?, #replace_all_html_colours_in_this, #replace_bold_token_with_default_colour, #replace_italic_token_with_default_colour, #replace_italic_token_with_this_colour, #replace_regular_numbers_with_unicode_numbers, #replace_underline_token_with_default_colour, #replace_underline_token_with_this_colour, #require_open_uri, #reset_the_internal_state, #return_all_bachelor_lectures, #return_all_exams_on_this_day, #return_all_numbers_from, #return_all_registered_curricula, #return_all_steop_lectures, #return_current_year, #return_dataset_for_this_topic, #return_dataset_from_this_curriculum_file, #return_dd_mm_yy_and_time_from, #return_directory_for, #return_ects_points_from_these_lectures, #return_either_grey_or_the_custom_colour_for_answers, #return_either_grey_or_the_custom_colour_for_questions, #return_file_for_this_curriculum, #return_german_name_for_this_english_month, #return_german_weekday_of?, #return_hh_mm_ss_from, #return_hour_from_this, #return_lectures_from_bachelor_vektor_curriculum, #return_lectures_with_at_the_least_one_upcoming_exam, #return_local_path_of_this_pwdstud, #return_lva_number_of_this_lecture, #return_month_fitting_to_this_input, #return_n_days_until_monday, #return_n_days_until_sunday, #return_n_exam_questions_in, #return_n_questions_were_answered_for_this_topic, #return_name_of_the_weekday, #return_name_of_this_curriculum, #return_name_of_this_curriculum_based_on_its_id_number, #return_opnn, #return_passed_courses, #return_pwd, #return_random_curriculum, #return_sanitized_dataset_from_the_file_lecture_information, #return_solved_lectures, #return_steop_lectures, #return_the_remote_homepage_url, #return_this_line_has_n_characters_as_html_colour_tags, #return_title_from_this_curriculum_file, #right_arrow?, #rinstall2, #roebe_exam_directory?, #roebe_path_to_file_lecture_information?, #ruby_src_dir_at_home?, #sanitize_this_topic, #sanitize_url, #select_for_prüfungsimmanente_LVs, #select_lectures_with_this_key, #set_be_verbose, #set_this_cd_alias_to, #set_xorg_buffer, #sfancy, #shall_we_make_use_of_unicode_symbols?, #show_todays_date, #silently_open_in_browser, #simp, #sort_these_lecture_names_by_time, #spacer, #studium_log_dir?, #this_month_has_n_days?, #total_ects_points_passed, #translate_dd_mm_yyyy_to_weekday, #try_to_require_html_templates, #try_to_require_the_open_gem, #try_to_require_the_rcfiles, #try_to_require_the_verbose_truth_gem, #turn_this_array_into_the_full_dataset, #unicode_blocks_line, #use_colours?, #use_opn?, #vertical_bar?, #web_liner, #weekday?, #weekdays?, #word_wrap, #write_what_into, #www_connection_is_unavailable, #yaml_dir?, #yellowrev, #yes_or_no

Methods included from RunmodeModule

#commandline?, #runmode?, #set_commandline_mode, #set_runmode, #set_www_mode, #www_mode?

Methods included from CommandlineArgumentsModule

#commandline_arguments_joined, #commandline_arguments_with_hyphens?, #commandline_arguments_without_leading_hyphens?, #first_argument?, #first_non_hyphen_argument?, #reset_the_commandline_arguments, #set_first_argument

Methods included from HtmlColoursModule

#aquamarine, #blanchedalmond, #brown, #cadetblue, #chocolate, #coral, #cornflowerblue, #crimson, #cyan, #darkblue, #darkcyan, #darkgoldenrod, #darkgreen, #darkkhaki, #darkolivegreen, #darkorange, #darkred, #darkseagreen, #darkslateblue, #darkslategray, #darkturquoise, #deepskyblue, #firebrick, #forestgreen, #gold, #goldenrod, #green, #grey, #indianred, #khaki, #lavender, #lawngreen, #lightblue, #lightcoral, #lightgreen, #lightred, #lightseagreen, #lightskyblue, #lightslategray, #lightslategrey, #lime, #limegreen, #mediumaquamarine, #mediumblue, #mediumpurple, #mediumseagreen, #mediumslateblue, #mediumspringgreen, #mediumturquoise, #mediumvioletred, #mintcream, #moccasin, #oldlace, #olive, #olivedrab, #orange, #orangered, #orchid, #palegoldenrod, #palegreen, #paleturquoise, #palevioletred, #peru, #plum, #powderblue, #red, #rosybrown, #royalblue, #saddlebrown, #salmon, #sandybrown, #seagreen, #sienna, #silver, #skyblue, #slateblue, #slategray, #springgreen, #steelblue, #tan, #teal, #thistle, #tomato, #turquoise, #violet, #whitesmoke, #yellow, #yellowgreen

Methods included from Colours

#bold_blue, #bold_red, #bold_yellow, cadetblue, #cadetblue, #chartreuse, #coral, coral, #cornflowerblue, cornflowerblue, crimson, #cyan, cyan, darkgoldenrod, #darkgoldenrod, #darkgray, darkgreen, darkolivegreen, darkseagreen, #darkslateblue, darkslateblue, #darkslategray, darkslategray, #darkturquoise, darkturquoise, #deepskyblue, deepskyblue, default_colour, #dimgray, disable_colours, #dodgerblue, e, #efancy, enable_colours, #erev, #ewarn, #forestgreen, forestgreen, gold, #goldenrod, goldenrod, #grey, grey, indianred, #indianred, khaki, #khaki, lawngreen, #lawngreen, lightblue, lightgreen, lightsalmon, #lightseagreen, lightseagreen, lightskyblue, #lightskyblue, #lightslategray, lightslategray, #lightsteelblue, lime, #lime, limegreen, #limegreen, #mediumaquamarine, mediumaquamarine, #mediumorchid, #mediumpurple, mediumpurple, #mediumseagreen, mediumseagreen, #mediumslateblue, mediumslateblue, #mediumspringgreen, mediumspringgreen, #mediumturquoise, mediumturquoise, #oldlace, olive, #olive, olivedrab, #olivedrab, orange, orangered, #orchid, orchid, palegreen, #palegreen, paleturquoise, #paleturquoise, palevioletred, #papayawhip, peru, #peru, plum, #plum, #powderblue, powderblue, rev, #rev?, royalblue, saddlebrown, #saddlebrown, #sandybrown, sandybrown, sdir, #sdir, seagreen, #seagreen, sfancy, #sfancy, sfile, #sfile, #simp, simp, #skyblue, skyblue, slateblue, #slategray, slategray, springgreen, #springgreen, #steelblue, steelblue, #swarn, swarn, #tan, tan, teal, #teal, #tomato, tomato, turquoise, use_colours?, use_this_colour_for_exam_answers, use_this_colour_for_exam_questions, #yellow, yellowgreen, #yellowgreen

Constructor Details

#initialize(commandline_arguments = ARGV, run_already = true) ⇒ DetermineCurricula

#

initialize

#


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/studium/curricula/determine_curricula/initialize.rb', line 14

def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  set_commandline_arguments(
    commandline_arguments
  )
  reset
  # ======================================================================= #
  # === Handle blocks
  # ======================================================================= #
  if block_given?
    yielded = yield
    case yielded
    # ===================================================================== #
    # === :do_not_run_yet
    # ===================================================================== #
    when :do_not_run_yet
      run_already = false
    # ===================================================================== #
    # === :do_not_report
    #
    # Use this like so:
    #
    #   x = Studium::DetermineCurricula.new('indi2') { :do_not_report }
    #
    # ===================================================================== #
    when :do_not_report
      @may_we_report = false
    end
  end
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

Studium::DetermineCurricula[]

#


383
384
385
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 383

def self.[](i = '')
  new(i)
end

Instance Method Details

#add_30_ects_pointsObject

#

add_30_ects_points

This method can be used to add the “Masterarbeit”.

#


247
248
249
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 247

def add_30_ects_points
  @total_ects_points += 30
end

#append_entries_from_this_curriculum(i = :bachelor_vektoren) ⇒ Object

#

append_entries_from_this_curriculum

Input to this method should be a file containing the lectures of the given individual curriculum.

#


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 17

def append_entries_from_this_curriculum(
    i = :bachelor_vektoren
  )
  dataset = ''.dup
  use_these_files = curriculum_location_of(i)
  case i
  # ======================================================================= #
  # === :indi3
  # ======================================================================= #
  when :indi3,
       :master_bioinformatics_and_nanobiotechnology_in_molecular_medicine,
       :master_bioinformatics_and_molecular_biotechnology,
       :master_informatik_und_molekulare_biologie
    use_these_files = curriculum_location_of(:indi3)
  # ======================================================================= #
  # === :indi2
  # ======================================================================= #
  when :indi2,
       :bachelor_bioinformatik_und_biotechnologie
    use_these_files = curriculum_location_of(:bachelor_bioinformatik_und_biotechnologie)
  # ======================================================================= #
  # === :master_dummy
  # ======================================================================= #
  when :master_dummy,
       :mdummy
    use_these_files = curriculum_location_of(:master_dummy_curriculum)
  # ======================================================================= #
  # === :dummy
  # ======================================================================= #
  when :dummy,
       :bachelor_dummy
    use_these_files = curriculum_location_of(:bachelor_dummy_curriculum)
  # ======================================================================= #
  # === :indi4
  # ======================================================================= #
  when :indi4,
       :bachelor_biologische_informatik
    use_these_files = curriculum_location_of(:indi4)
  # ======================================================================= #
  # === :bachelor_master_vektoren
  # ======================================================================= #
  when :bachelor_master_vektoren
    if @show_only_master_curricula
      use_these_files = curriculum_location_of(:master_vektoren)
    elsif @show_only_bachelor_curricula
      use_these_files = curriculum_location_of(:bachelor_vektoren)
    else
      use_these_files = [
        curriculum_location_of(:bachelor_vektoren),
        curriculum_location_of(:master_vektoren)
      ]
    end
  end
  unless use_these_files.is_a? Array # Ensure that we work on an Array.
    use_these_files = [use_these_files]
  end
  use_these_files.flatten!
  notify_the_user_that_these_files_will_be_used(use_these_files)
  # ======================================================================= #
  # Now that we have notified the user which files will be used,
  # we can read in these files.
  # ======================================================================= #
  use_these_files.each {|this_file|
    content_from_this_file = read_this_file(this_file)
    set_title_from_this_file(content_from_this_file)
    dataset << content_from_this_file
  }
  # ======================================================================= #
  # Next, get rid of all lines that start with '#' or that are completely
  # empty. We will apply .strip prior to checking for '#' because there
  # may also be entries such as '             # === STEOP END'.
  # ======================================================================= #
  dataset = dataset.split(N).reject {|line|
    line.strip.empty? or line.strip.start_with? '#'
  }
  dataset.map! {|line|
    if line.include? '#'
      line = line[0 .. (line.index('#') - 1)]
    end
    line.strip!
    line.squeeze(' ')
  }
  @dataset = dataset
end

#bachelor?Boolean

#

bachelor?

#

Returns:

  • (Boolean)


145
146
147
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 145

def bachelor?
  @show_only_bachelor_curricula
end

#colourize_this_file_with_two_colours(i) ⇒ Object

#

colourize_this_file_with_two_colours

#


112
113
114
115
116
117
118
119
120
121
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 112

def colourize_this_file_with_two_colours(i)
  if i.include? '/'
    i = sfile(i)
    splitted = i.split('/')
    last_part = splitted.last
    splitted[-1] = paleturquoise(last_part)
    i = splitted.join('/')
  end
  i
end

#commandline_arguments?Boolean Also known as: input?

#

commandline_arguments?

#

Returns:

  • (Boolean)


185
186
187
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 185

def commandline_arguments?
  @commandline_arguments
end

#consider_using_a_default_curriculum_if_no_other_instructions_were_issuedObject

#

consider_using_a_default_curriculum_if_no_other_instructions_were_issued

This method ensures that we can work on a default curriculum, if no other dataset has been provided.

#


202
203
204
205
206
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 202

def consider_using_a_default_curriculum_if_no_other_instructions_were_issued
  append_entries_from_this_curriculum(
    :bachelor_master_vektoren
  ) if @dataset.nil?
end

#dataset_from_file_lecture_information?Boolean

#

dataset_from_file_lecture_information?

#

Returns:

  • (Boolean)


166
167
168
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 166

def dataset_from_file_lecture_information?
  @dataset_from_file_lecture_information
end

#do_show_only_bachelor_curriculaObject

#

do_show_only_bachelor_curricula

Use this method if you only want to show bachelor-curricula.

#


238
239
240
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 238

def do_show_only_bachelor_curricula
  @show_only_bachelor_curricula = true
end

#do_show_only_master_curriculaObject

#

do_show_only_master_curricula

#


229
230
231
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 229

def do_show_only_master_curricula
  @show_only_master_curricula = true
end

#do_these_curricula_contain_at_the_least_one_bachelor_course?(i) ⇒ Boolean

#

do_these_curricula_contain_at_the_least_one_bachelor_course?

This method will return true if any of the input-array starts with the string ‘033’.

#

Returns:

  • (Boolean)


222
223
224
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 222

def do_these_curricula_contain_at_the_least_one_bachelor_course?(i)
  i.any? {|line| line.start_with? '033' }
end

#find_entry_corresponding_to_this_line(line) ⇒ Object

#

find_entry_corresponding_to_this_line

#


159
160
161
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 159

def find_entry_corresponding_to_this_line(line)
  @dataset_from_file_lecture_information[line]
end

#is_it_a_bachelor_curriculum?Boolean

#

is_it_a_bachelor_curriculum?

Here we assume that a bachelor curriculum will have 180.0 ECTS points in total.

#

Returns:

  • (Boolean)


138
139
140
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 138

def is_it_a_bachelor_curriculum?
  @total_ects_points == 180.0
end

#is_this_curriculum_an_individual_curriculum?(i = @title) ⇒ Boolean

#

is_this_curriculum_an_individual_curriculum?

#

Returns:

  • (Boolean)


126
127
128
129
130
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 126

def is_this_curriculum_an_individual_curriculum?(
    i = @title
  )
  ARRAY_TITLE_OF_THE_INDIVIDUAL_CURRICULA.include?(i)
end

#iterate_over_the_main_datasetObject

#

iterate_over_the_main_dataset

This method is the main powerhorse method of this class. In order for it to work, the variable @dataset must exist.

#


289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 289

def iterate_over_the_main_dataset
  if may_we_report?
    e lime("#{@title}:")+N+N # In lime colour.
  end
  @dataset.each_with_index {|line, index| index += 1
    line.squeeze!(' ')
    _ = find_entry_corresponding_to_this_line(line)
    if _
      n_ects_points = _[:ects]
      if n_ects_points.nil?
        opne "#{swarn('DEBUG:')} Something went wrong with the entry `"\
                "#{sfancy(entry)}`: No ects points were found."
      end
      curricula = _['curricula']
      # =================================================================== #
      # === Intercept erroneous curricula-entries (nil or empty)
      #
      # Note that the above variable can still be nil, so we must
      # handle these cases.
      # =================================================================== #
      if curricula.nil? or curricula.empty? 
        opne "No entry appears to be registered for the "\
                "lecture #{simp(line)}"
      end
      unless curricula.is_a? Array
        curricula = [curricula]
      end
      @total_ects_points += n_ects_points
      curriculum_number = turquoise('[Curricula used: ')+
                          springgreen(
                            curricula.join(', ').to_s
                          )+turquoise(']:')
      padded_this_lecture = remove_leading_numbers(
        line
      ).ljust(88)
      # =================================================================== #
      # Report the lecture here.
      # =================================================================== #
      if may_we_report?
        e "#{orange((index.to_s+')').rjust(4))} "\
          "#{sfancy(padded_this_lecture)} #{curriculum_number}"
      end
      curricula.each {|this_curriculum|
        @hash_storing_all_curricula[this_curriculum] += n_ects_points
      }
      # =================================================================== #
      # Next, add a random entry to the university at hand:
      # =================================================================== #
      sample = curricula.sample
      this_university = from_curriculum_id_to_university(sample)
      if this_university.nil?
        # ================================================================= #
        # We have two ways: first we determine the university from
        # the variable @dataset_from_file_lecture_information;
        # and if this still does not work then we will simply
        # report to the user that something is wrong.
        # ================================================================= #
        if @dataset_from_file_lecture_information.has_key?(line)
          this_university = @dataset_from_file_lecture_information[line][:university]
          case this_university
          when /^TU Vienna$/
            this_university = 'TU Wien'
          end
        else
          opne 'Careful - a nil value has been obtained for '+sfancy(sample)+'.'
          opne 'Right now this means that the program will stop here, so'
          opne 'that this error can be corrected.'
          opne 'The curricula used here were:'
          pp curricula
          e steelblue(padded_this_lecture)
          exit
        end
      end
      @hash_n_ects_at_this_university[this_university] += n_ects_points.to_f
    else
      opne "No entry was found for `#{sfancy(line.to_s)}#{rev}`."
      opne 'This must be corrected before we can continue.'
      opne "Have a look at the file `#{sfile(main_file?)}`#{rev}."
      if line.to_s.empty?
        opne "#{rev}As the line was empty, we will show the whole "\
             "@dataset variable next:"
        e
        pp @dataset
        e
      end
      opne 'Exiting now.'
      exit
    end
  }
end

#lectures?Boolean

#

lectures?

#

Returns:

  • (Boolean)


272
273
274
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 272

def lectures?
  @dataset
end

#main_file?Boolean

#

main_file?

#

Returns:

  • (Boolean)


105
106
107
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 105

def main_file?
  Studium.file_lecture_information
end

#master?Boolean

#

master?

#

Returns:

  • (Boolean)


152
153
154
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 152

def master?
  @show_only_master_curricula
end

#may_we_report?Boolean

#

may_we_report?

#

Returns:

  • (Boolean)


279
280
281
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 279

def may_we_report?
  @may_we_report
end
#

menu (menu tag)

#


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/studium/curricula/determine_curricula/menu.rb', line 14

def menu(
    i = commandline_arguments?
  )
  if i.is_a? Array
    i.each {|entry| menu(entry) }
  else
    case i # case tag
    # ===================================================================== #
    # === detcur --indi1
    #
    # This is also known as indi1, at the TU Vienna. The name is
    # "Bachelorcurriculum Informatik und molekulare Biologie".
    # ===================================================================== #
    when /^-?-?indi1$/i,
         /^-?-?bachelor(-|_)?informatik(-|_)?und(-|_)?molekulare(-|_)?biologie$/i,
         /^-?-?bachelor(-|_)?biologische(-|_)?informatik$/i
      append_entries_from_this_curriculum(:bachelor_informatik_und_molekulare_biologie)
    # ===================================================================== #
    # === detcur --indi2
    #
    # This is also known as indi2. The title is "Bachelorcurriculum
    # (Bio)Informatik und molekulare Biotechnologie, unter
    # Berücksichtigung medizinisch-immunologischer Aspekte".
    # ===================================================================== #
    when /^-?-?indi2$/i,
         /^-?-?bachelor(-|_)?bioinformatik(-|_)?und(-|_)?biotechnologie$/i
      append_entries_from_this_curriculum(:indi2)
    # ===================================================================== #
    # === detcur --indi3
    #
    # This is known as "indi3" since as of June 2022.
    # ===================================================================== #
    when /^-?-?indi3$/i,
         /^-?-?master(-|_)?boku(-|_)?individuell$/i,
         '3'
      # add_30_ects_points
      append_entries_from_this_curriculum(:indi3)
    # ===================================================================== #
    # === detcur --bvektoren --only-bachelor
    #
    # This is also known as "indi3" since as of June 2022.
    # ===================================================================== #
    when /^-?-?bachelor(-|_)?vektoren$/i,
         /^-?-?bachelor(-|_)?vektor$/i,
         /^-?-?bvektoren$/i,
         /^-?-?bvektor$/i,
         /^-?-?indi5$/i,
         /^-?-?indi$/i,
         /^-?-?bvek$/i,
         /^-?-?bvec$/i,
         '5'
      append_entries_from_this_curriculum(:bachelor_vektoren)
    # ===================================================================== #
    # === detcur --indi4
    #
    # This is also known as indi4, a master-curriculum.
    # ===================================================================== #
    when /^-?-?indi4$/i,
         /^-?-?master(-|_)?bioinformatics(-|_)?and(-|_)?molecular(-|_)?biotechnology$/i,
         /^-?-?master(-|_)?informatik(-|_)?und(-|_)?molekulare(-|_)?biologie$/i,
         /^-?-?master(-|_)?biologische(-|_)?informatik$/i
      append_entries_from_this_curriculum(:master_bioinformatics_and_molecular_biotechnology)
    # ===================================================================== #
    # === detcur --bachelor_dummy
    # ===================================================================== #
    when /^-?-?bachelor(-|_)?dummy?$/i,
         /^-?-?dummy?$/i
      append_entries_from_this_curriculum(:bachelor_dummy)
    # ===================================================================== #
    # === detcur --master_dummy
    # ===================================================================== #
    when /^-?-?master(-|_)?dummy?$/i,
         /^-?-?mdummy?$/i
      append_entries_from_this_curriculum(:master_dummy)
    # ===================================================================== #
    # === detcur --master-vektoren
    # ===================================================================== #
    when /^-?-?master(-|_)?vektoren$/i,
         /^-?-?master(-|_)?vektorx?$/i,
         /^-?-?mvek$/i,
         /^-?-?mvec$/i,
         /^-?-?mvektor$/i,
         '4'
      append_entries_from_this_curriculum(:master_vektoren)
      add_30_ects_points
    # ===================================================================== #
    # === detcur --bachelor-master-vektoren
    # ===================================================================== #
    when /^-?-?bachelor(-|_)?master(-|_)?vektoren$/i,
         '6',
         :default # This is the default entry point.
      append_entries_from_this_curriculum(:bachelor_master_vektoren)
    # ===================================================================== #
    # === detcur --only-bachelor-curricula
    # ===================================================================== #
    when /^-?-?only(-|_)?bachelor(-|_)?curricula$/i,
         /^-?-?only(-|_)?bachelor$/i,
         /^-?-?bachelor$/i,
         /^-?-?b$/i
      do_show_only_bachelor_curricula
    # ===================================================================== #
    # === detcur --bachelor-mikrobiologie
    # ===================================================================== #
    when /^-?-?bachelor(-|_)?mikrobiologie$/i
      append_entries_from_this_curriculum(:bachelor_mikrobiologie)
    # ===================================================================== #
    # === detcur --only-master-curricula
    # ===================================================================== #
    when /^-?-?only(-|_)?master(-|_)?curricula$/i,
         /^-?-?only(-|_)?master$/i,
         /^-?-?master$/i
      do_show_only_master_curricula
    # ===================================================================== #
    # === detcur --help
    # ===================================================================== #
    when /help/
      show_help
      exit
    # ===================================================================== #
    # === detcur ----bachelor-molbio
    # ===================================================================== #
    when /^-?-?bachelor(-|_)?mol(-|_)?bio$/i,
         '7'
      append_entries_from_this_curriculum(:bachelor_molbio)
    # ===================================================================== #
    # === detcur --bachelor-boku-individuell
    # ===================================================================== #
    when /^-?-?bachelor(-|_)?boku(-|_)?individuell$/i,
         '8'
      append_entries_from_this_curriculum(:bachelor_boku_individuell)
    else
      opne "Input #{sfancy(i)} was not found. Is it registered?"
      exit
    end
  end
end

#notify_the_user_that_these_files_will_be_used(i) ⇒ Object

#

notify_the_user_that_these_files_will_be_used (notify tag)

#


254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 254

def notify_the_user_that_these_files_will_be_used(i)
  if may_we_report?
    opne 'The following file(s) will be used:'
    result = ''.dup
    result << N
    i.each_with_index {|this_file, index| index += 1
      result << "   (#{index}) "\
                "#{colourize_this_file_with_two_colours(this_file)}#{N}#{N}"
    }
    result.chomp!
    result << N
    e result
  end
end

#remove_leading_numbers(i) ⇒ Object

#

remove_leading_numbers

#


192
193
194
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 192

def remove_leading_numbers(i)
  i.sub(/^\d{1,7}\.?[A-Z]{0,1}\d{1,4} /,'') # <- Must also check for "185.A47" entries.
end

#reportObject

#

report (report tag)

#


119
120
121
# File 'lib/studium/curricula/determine_curricula/report.rb', line 119

def report
  report_curricula_used
end

#report_curricula_usedObject

#

report_curricula_used (report tag)

#


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/studium/curricula/determine_curricula/report.rb', line 17

def report_curricula_used
  golden_arrow = gold(" #{right_arrow?} ")
  # ======================================================================= #
  # We must first sort the Hash.
  # The entries it uses are: "033630" => 61.5
  # ======================================================================= #
  sorted = @hash_storing_all_curricula.sort_by {|name_of_the_curriculum, n_ects_points|
    n_ects_points
  }.reverse
  e
  e "This curriculum has a total of "\
    "#{orange(@total_ects_points.to_s)} ECTS points. "\
    "The percentage value will be shown as well.#{N}#{N}"
  index = 0
  sorted.each {|id_number_of_the_curriculum, n_ects_points| index += 1
    if @show_only_bachelor_curricula and
       id_number_of_the_curriculum.start_with?('066','800','990')
      next # The above entries ^^^ are not really bachelor-courses, so we skip them.
    end
    if @show_only_master_curricula and
       id_number_of_the_curriculum.start_with?('033','193','198')
      next # Here we skip "Lehramt".
    end
    name_of_the_curriculum = return_name_of_this_curriculum_based_on_its_id_number(id_number_of_the_curriculum)
    next if name_of_the_curriculum.nil? or name_of_the_curriculum.include? 'Lehramt'
    if name_of_the_curriculum.nil?
      opne "No name could be found for curriculum number "\
              "#{sfancy(id_number_of_the_curriculum)}"
    end
    if id_number_of_the_curriculum and !id_number_of_the_curriculum.empty?
      this_university = from_curriculum_id_to_university(id_number_of_the_curriculum)
    else
      this_university = "Unregistered curriculum-id "\
                        "(#{id_number_of_the_curriculum})."
    end
    properly_formatted_and_colourized_string_showing_the_respective_university =
      seagreen(
        ' ['+this_university.to_s.center(12)+']'
      )
    # ===================================================================== #
    # The amount of ECTS points will be shown on the right hand side.
    # ===================================================================== #
    colourized_and_padded_n_ects_points = mediumseagreen(
      n_ects_points.to_s.rjust(4)+' ECTS points'
    )
    # ===================================================================== #
    # Next we will colourizing the ID of the curriculum. The last three
    # letters will be in a slightly lighter colour tone.
    # ===================================================================== #
    id_number_of_the_curriculum = id_number_of_the_curriculum.center(6)
    first_part = id_number_of_the_curriculum[0 .. -4]
    last_part  = id_number_of_the_curriculum[-3,3]
    colourized_id_of_the_curriculum = sfancy(' (')+
      mediumslateblue(first_part)+
      mediumpurple(last_part)+ 
      sfancy(')')
    n_percent = (
      ( n_ects_points * 100 ) / @total_ects_points
    ).round(1)
    percentage_string = springgreen(
      ' ['+n_percent.to_s.rjust(4)+'%]'
    )
    if is_this_curriculum_an_individual_curriculum? and
       is_it_a_bachelor_curriculum? and
       !name_of_the_curriculum.include?('Bachelorcurriculum ')
      # ===================================================================== #
      # In this case simply pass-through, but notify the user about this
      # at a later time.
      # ===================================================================== #
    else
      # ===================================================================== #
      # Finally report our findings to the user:
      # ===================================================================== #
      e lightgreen(
          index.to_s.rjust(2)+
          ') '
        )+
        slateblue(
          name_of_the_curriculum.ljust(82)
        )+
        colourized_id_of_the_curriculum+
        golden_arrow+ # A cute, golden "arrow".
        colourized_and_padded_n_ects_points+
        properly_formatted_and_colourized_string_showing_the_respective_university+
        percentage_string
    end
  }; e
  if is_this_curriculum_an_individual_curriculum? and
     is_it_a_bachelor_curriculum?
    e coral('   This is an individual bachelor-curriculum, so master-lectures')
    e coral('   have not been shown in the above commandline-table.')
    e
  end
  # ======================================================================= #
  # Next show how many ECTS points are allotted to each university.
  # ======================================================================= #
  report_n_ects_per_university
end

#report_n_ects_per_universityObject

#

report_n_ects_per_university

This method will report the ECTS attribution per university, e. g. 20.0 ECTS at the BOKU, 10.0 ECTS at the TU Vienna, and so forth.

The input Hash should look like this:

{"TU Wien"=>115.5, "Uni Wien"=>30.0, "BOKU Wien"=>26.0, "Vetmed Wien"=>8.5}
#


134
135
136
137
138
139
# File 'lib/studium/curricula/determine_curricula/report.rb', line 134

def report_n_ects_per_university
  Studium.report_n_ects_per_university(
    @hash_n_ects_at_this_university,
    @total_ects_points
  )
end

#resetObject

#

reset

#


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/studium/curricula/determine_curricula/reset.rb', line 16

def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @dataset_from_file_lecture_information
  # ======================================================================= #
  @dataset_from_file_lecture_information = dataset_from_file_lecture_information
  # ======================================================================= #
  # === @may_we_report
  # ======================================================================= #
  @may_we_report = true
  # ======================================================================= #
  # === @total_ects_points
  # ======================================================================= #
  @total_ects_points = 0
  # ======================================================================= #
  # === @title
  # ======================================================================= #
  @title = nil
  # ======================================================================= #
  # === @dataset
  # ======================================================================= #
  @dataset = nil
  # ======================================================================= #
  # === @hash_storing_all_curricula
  # ======================================================================= #
  @hash_storing_all_curricula = {}
  @hash_storing_all_curricula.default = 0
  # ======================================================================= #
  # === @show_only_bachelor_curricula
  # ======================================================================= #
  @show_only_bachelor_curricula = false
  # ======================================================================= #
  # === @show_only_master_curricula
  # ======================================================================= #
  @show_only_master_curricula = false
  # ======================================================================= #
  # === @hash_n_ects_at_this_university
  # ======================================================================= #
  @hash_n_ects_at_this_university = {}
  @hash_n_ects_at_this_university.default = 0
end

#runObject

#

run

#


12
13
14
15
16
17
# File 'lib/studium/curricula/determine_curricula/run.rb', line 12

def run
  menu
  consider_using_a_default_curriculum_if_no_other_instructions_were_issued
  iterate_over_the_main_dataset
  report if @may_we_report
end

#set_commandline_arguments(i = :default) ⇒ Object

#

set_commandline_arguments

#


173
174
175
176
177
178
179
180
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 173

def set_commandline_arguments(
    i = :default
  )
  if i.is_a? Array and i.empty?
    i << :default
  end
  @commandline_arguments = i
end

#set_title_from_this_file(i) ⇒ Object

#

set_title_from_this_file

#


211
212
213
214
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 211

def set_title_from_this_file(i)
  i = i.split(N)[1].delete('#=').strip
  @title = i
end

#show_helpObject

#

show_help (help tag)

#


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/studium/curricula/determine_curricula/help.rb', line 14

def show_help
  result =<<EOF

Several curricula are defined. Only a few will be highlighted here:
 
detcur --bvektoren
detcur --bachelor-vektoren
detcur --bvektor
detcur --master-vektoren
detcur --bachelor-master-vektoren
detcur --bachelor-genetik
detcur --bachelor-mikrobiologie                      # ← individual curriculum
detcur --bachelor-informatik-und-molekulare-biologie # ← individual curriculum
detcur --dummy                                       # ← generic individual curriculum

If you only want to show courses registered in a bachelor-curriculum
then you may want to use the option:
 
detcur --only-bachelor-curricula
detcur --only-master-curricula

EOF
  e result
end