Class: Studium::DetermineCurricula
- Inherits:
-
Base
- Object
- Base
- Studium::DetermineCurricula
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
collapse
- NAMESPACE =
inspect
Constants inherited
from Base
Base::ARRAY_HTML_COLOURS_IN_USE, Base::CHECK_FOR_INCORRECT_ENTRIES_IN_THE_QUESTION_ANSWER_FILE_THAT_SHOULD_BE_COMMENTS, Base::COLOURS, Base::COMMON_YEAR_DAYS_IN_MONTH, Base::GRAY, Base::LEFT_PADDING, Base::N_CHARACTERS_PER_LINE, Base::UNICODE_RIGHT_ARROW
Constants included
from Colours
Colours::COLOURS
Class Method Summary
collapse
-
.[](i = '') ⇒ Object
# === Studium::DetermineCurricula[] ========================================================================= #.
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, #base_dir?, #be_silent, #be_verbose?, #beautiful_url, #change_directory, #cheering_person, #cliner, #colour_for_ects_points, #colourize_percentage, #commandline_arguments_joined, #commandline_arguments_with_hyphens?, #convert_this_array_of_lectures_into_the_full_dataset, #copy, #cpruby, #create_directory, #create_file, #csv_file?, #current_month?, #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?, #e, #ecomment, #editor?, #ee, #enable_colours, #enable_colours_globally, #enable_debug, #encoding?, #english_to_german_weekday, #ensure_main_encoding, #ensure_that_the_log_directory_exists, #eparse, #erev, #esystem, #etomato, #exit_program, #expand_topic, #extract_dd_mm_yyyy, #file_lecture_information?, #file_read_with_proper_encoding, #filter_away_invalid_questions, #find_corresponding_exam_topic, #first_argument?, #first_non_hyphen_argument?, #from_curriculum_id_to_university, #german_date_notation, #german_weekday?, #german_weekdays?, #has_a_bachelor_curriculum?, #has_a_master_curriculum?, #has_this_exam_topic_been_solved?, #has_year_entry?, #hh_mm_ss_dd_mm_yyyy, #horizontal_bar?, #html_log_directory?, #is_a_master_lecture?, #is_a_weekday?, #is_connected_to_the_www?, #is_on_roebe?, #is_prüfungsimmanent?, #is_this_a_valid_html_colour?, #is_this_day_today?, #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, #load_yaml_dataset, #move_file, #n_days_difference_from_today_to_this_day, #no_ext_name, #no_file_at, #number_to_month, #obtain, #obtain_lectures_from_this_curriculum, #open_in_editor, #opnn, #path_to_exam_topic?, #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, #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, #rev, #right_arrow?, #rinstall2, #roebe_exam_directory?, #ruby_src_dir_at_home?, #runmode?, #sanitize_this_topic, #sanitize_url, #select_lectures_with_this_key, #set_be_quiet, #set_be_verbose, #set_commandline_mode, #set_runmode, #set_this_cd_alias_to, #set_www_mode, #sfancy, #shall_we_make_use_of_unicode_symbols?, #show_todays_date, #simp, #sort_these_lecture_names_by_time, #spacer, #swarn, #this_month_has_n_days?, #total_ects_points_passed, #translate_dd_mm_yyyy_to_weekday, #try_to_require_the_rcfiles, #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, #www_mode?, #yaml_dir?
Methods included from Colours
#bold_blue, #bold_red, #bold_yellow, #cadetblue, #chartreuse, crimson, #darkgray, darkgreen, darkseagreen, deepskyblue, #deepskyblue, default_colour, #dimgray, disable_colours, #dodgerblue, e, #efancy, enable_colours, #ewarn, #forestgreen, gold, #grey, lightblue, lightgreen, #lightslategray, #lightsteelblue, #mediumorchid, #mediumseagreen, #oldlace, #olivedrab, orange, orangered, #orchid, palevioletred, #papayawhip, rev, royalblue, sdir, #sdir, sfancy, #sfancy, sfile, #sfile, simp, #simp, slateblue, steelblue, #steelblue, #swarn, swarn, #teal, turquoise, use_colours?, use_this_colour_for_exam_answers, use_this_colour_for_exam_questions, #yellow
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ DetermineCurricula
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
if block_given?
yielded = yield
case yielded
when :do_not_run_yet
run_already = false
when :do_not_report
@may_we_report = false
end
end
run if run_already
end
|
Class Method Details
.[](i = '') ⇒ Object
#
Studium::DetermineCurricula[]
#
382
383
384
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 382
def self.[](i = '')
new(i)
end
|
Instance Method Details
#add_30_ects_points ⇒ Object
#
add_30_ects_points
This method can be used to add the “Masterarbeit”.
#
246
247
248
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 246
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
|
# 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
when :master_bioinformatics_and_molecular_biotechnology,
:master_informatik_und_molekulare_biologie,
:indi4
use_these_files = curriculum_location_of(:master_bioinformatics_and_molecular_biotechnology)
when :master_dummy,
:mdummy
use_these_files = curriculum_location_of(:master_dummy_curriculum)
when :dummy,
:bachelor_dummy
use_these_files = curriculum_location_of(:bachelor_dummy_curriculum)
when :indi3,
:bachelor_biologische_informatik
use_these_files = curriculum_location_of(:bachelor_biologische_informatik)
when :indi2,
:bachelor_bioinformatik_und_biotechnologie
use_these_files = curriculum_location_of(:bachelor_bioinformatik_und_biotechnologie)
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 use_these_files = [use_these_files]
end
use_these_files.flatten!
notify_the_user_that_these_files_will_be_used(use_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
}
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
137
138
139
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 137
def bachelor?
@show_only_bachelor_curricula
end
|
#colourize_this_file_with_two_colours(i) ⇒ Object
#
colourize_this_file_with_two_colours
#
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 104
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?
#
177
178
179
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 177
def commandline_arguments?
@commandline_arguments
end
|
#consider_using_a_default_curriculum_if_no_other_instructions_were_issued ⇒ Object
#
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.
#
194
195
196
197
198
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 194
def consider_using_a_default_curriculum_if_no_other_instructions_were_issued
append_entries_from_this_curriculum(
:bachelor_master_vektoren
) if @dataset.nil?
end
|
158
159
160
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 158
def dataset_from_file_lecture_information?
@dataset_from_file_lecture_information
end
|
#do_show_only_bachelor_curricula ⇒ Object
#
do_show_only_bachelor_curricula
Use this method if you only want to show bachelor-curricula.
#
237
238
239
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 237
def do_show_only_bachelor_curricula
@show_only_bachelor_curricula = true
end
|
#do_show_only_master_curricula ⇒ Object
#
do_show_only_master_curricula
#
228
229
230
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 228
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'.
#
221
222
223
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 221
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
#
151
152
153
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 151
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.
#
130
131
132
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 130
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?
#
118
119
120
121
122
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 118
def is_this_curriculum_an_individual_curriculum?(
i = @title
)
ARRAY_TITLE_OF_THE_INDIVIDUAL_CURRICULA.include?(i)
end
|
#iterate_over_the_main_dataset ⇒ Object
#
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.
#
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
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
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 274
def iterate_over_the_main_dataset
if may_we_report?
e lime("#{@title}:")+N+N 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?
opnn; e "#{swarn('DEBUG:')} Something went wrong with the entry `"\
"#{sfancy(entry)}`: No ects points were found."
end
curricula = _['curricula']
if curricula.nil? or curricula.empty?
opnn; e "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)
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
}
sample = curricula.sample
this_university = from_curriculum_id_to_university(sample)
if this_university.nil?
if @dataset_from_file_lecture_information.has_key?(line)
this_university = @dataset_from_file_lecture_information[line][:university]
unless this_university.end_with?(' Wien')
this_university = this_university.dup if this_university.frozen?
this_university << ' Wien'
end
else
opnn; e 'Careful - a nil value has been obtained for '+sfancy(sample)+'.'
opnn; e 'Right now this means that the program will stop here, so'
opnn; e 'that this error can be corrected.'
opnn; e '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
opnn; e "No entry was found for `#{sfancy(line.to_s)}`."
opnn; e 'This must be corrected before we can continue.'
opnn; e "Have a look at the file `#{sfile(main_file?)}`."
if line.to_s.empty?
opnn; e 'As the line was empty, we will show the whole '\
'@dataset variable next:'
e
pp @dataset
e
end
opnn; e 'Exiting now.'
exit
end
}
end
|
#lectures? ⇒ Boolean
368
369
370
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 368
def lectures?
@dataset
end
|
#main_file? ⇒ Boolean
211
212
213
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 211
def main_file?
FILE_LECTURE_INFORMATION
end
|
#master? ⇒ Boolean
144
145
146
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 144
def master?
@show_only_master_curricula
end
|
#may_we_report? ⇒ Boolean
375
376
377
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 375
def may_we_report?
@may_we_report
end
|
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
|
# File 'lib/studium/curricula/determine_curricula/menu.rb', line 14
def (
i = @commandline_arguments
)
if i.is_a? Array
i.each {|entry| (entry) }
else
case i when /^-?-?master(-|_)?vektoren$/i,
/^-?-?master(-|_)?vektorx?$/i,
/^-?-?mvek$/i,
/^-?-?mvec$/i,
/^-?-?mvektor$/i,
'2'
append_entries_from_this_curriculum(:master_vektoren)
add_30_ects_points
when /^-?-?bachelor(-|_)?vektoren$/i,
/^-?-?bachelor(-|_)?vektor$/i,
/^-?-?bvektoren$/i,
/^-?-?bvektor$/i,
/^-?-?indi1$/i,
/^-?-?indi$/i,
/^-?-?bvek$/i,
/^-?-?bvec$/i,
'1'
append_entries_from_this_curriculum(:bachelor_vektoren)
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)
when /^-?-?indi3$/i,
/^-?-?bachelor(-|_)?informatik(-|_)?und(-|_)?molekulare(-|_)?biologie$/i,
/^-?-?bachelor(-|_)?biologische(-|_)?informatik$/i
append_entries_from_this_curriculum(:bachelor_informatik_und_molekulare_biologie)
when /^-?-?indi2$/i,
/^-?-?bachelor(-|_)?bioinformatik(-|_)?und(-|_)?biotechnologie$/i
append_entries_from_this_curriculum(:indi2)
when /^-?-?master(-|_)?dummy?$/i,
/^-?-?mdummy?$/i
append_entries_from_this_curriculum(:master_dummy)
when /^-?-?only(-|_)?bachelor(-|_)?curricula$/i,
/^-?-?only(-|_)?bachelor$/i,
/^-?-?bachelor$/i,
/^-?-?b$/i
do_show_only_bachelor_curricula
when /^-?-?bachelor(-|_)?mikrobiologie$/i
append_entries_from_this_curriculum(:bachelor_mikrobiologie)
when /^-?-?bachelor(-|_)?master(-|_)?vektoren$/i,
'3', :default append_entries_from_this_curriculum(:bachelor_master_vektoren)
when /^-?-?only(-|_)?master(-|_)?curricula$/i,
/^-?-?only(-|_)?master$/i,
/^-?-?master$/i
do_show_only_master_curricula
when /help/
show_help
exit
when /^-?-?bachelor(-|_)?mol(-|_)?bio$/i,
'6'
append_entries_from_this_curriculum(:bachelor_molbio)
when /^-?-?master(-|_)?boku(-|_)?individuell$/i,
'5'
append_entries_from_this_curriculum(:master_boku_individuell)
add_30_ects_points
when /^-?-?bachelor(-|_)?boku(-|_)?individuell$/i,
'4'
append_entries_from_this_curriculum(:bachelor_boku_individuell)
else
opnn; e "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)
#
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 253
def notify_the_user_that_these_files_will_be_used(i)
if may_we_report?
opnn; e '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
#
184
185
186
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 184
def remove_leading_numbers(i)
i.sub(/^\d{1,7}\.?[A-Z]{0,1}\d{1,4} /,'') end
|
#report_curricula_used ⇒ Object
Also known as:
report
#
report_curricula_used (report tag)
#
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
|
# File 'lib/studium/curricula/determine_curricula/report.rb', line 37
def report_curricula_used
golden_arrow = gold(" #{right_arrow?} ")
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}"
sorted.each {|id_number_of_the_curriculum, n_ects_points|
if @show_only_bachelor_curricula and
id_number_of_the_curriculum.start_with?('066','800','990')
next end
if @show_only_master_curricula and
id_number_of_the_curriculum.start_with?('033','193','198')
next 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?
opnn; e "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)+']'
)
colourized_and_padded_n_ects_points = mediumseagreen(
n_ects_points.to_s.rjust(4)+' ECTS points'
)
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 ')
else
e slateblue(
name_of_the_curriculum.ljust(82)
)+
colourized_id_of_the_curriculum+
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
report_n_ects_per_university
end
|
#report_n_ects_per_university ⇒ Object
#
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}
#
#reset ⇒ Object
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
|
# File 'lib/studium/curricula/determine_curricula/reset.rb', line 16
def reset
super()
@namespace = NAMESPACE
@dataset_from_file_lecture_information = dataset_from_file_lecture_information
@may_we_report = true
@total_ects_points = 0
@title = nil
@dataset = nil
@hash_storing_all_curricula = {}
@hash_storing_all_curricula.default = 0
@hash_n_ects_at_this_university = {}
@hash_n_ects_at_this_university.default = 0
@show_only_bachelor_curricula = false
@show_only_master_curricula = false
end
|
#run ⇒ Object
12
13
14
15
16
17
|
# File 'lib/studium/curricula/determine_curricula/run.rb', line 12
def run
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
#
165
166
167
168
169
170
171
172
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 165
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
#
203
204
205
206
|
# File 'lib/studium/curricula/determine_curricula/misc.rb', line 203
def set_title_from_this_file(i)
i = i.split(N)[1].delete('#=').strip
@title = i
end
|
#show_help ⇒ Object
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
|