Class: Studium::CurriculumModuleDisplayer
- Inherits:
-
Base
- Object
- Base
- Studium::CurriculumModuleDisplayer
show all
- Defined in:
- lib/studium/curricula/curriculum_module_displayer/menu.rb,
lib/studium/curricula/curriculum_module_displayer/run.rb,
lib/studium/curricula/curriculum_module_displayer/reset.rb,
lib/studium/curricula/curriculum_module_displayer/constants.rb,
lib/studium/curricula/curriculum_module_displayer/initialize.rb,
lib/studium/curricula/curriculum_module_displayer/show_and_report.rb,
lib/studium/curricula/curriculum_module_displayer/set_use_this_curriculum.rb,
lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb
Overview
Studium::CurriculumModuleDisplayer
Constant Summary
collapse
- NAMESPACE =
inspect
- DEFAULT_CURRICULUM_TO_USE =
#
DEFAULT_CURRICULUM_TO_USE
#
:bachelor_vektor_curriculum
- ENSURE_MINIMUM_SIZE_OF_A_MODULE =
#
ENSURE_MINIMUM_SIZE_OF_A_MODULE
If the following constant is set to true then this class will warn if a module is too small - e. g. having less than the minimum amount of ECTS as specified below.
#
true
- MINIMAL_AMOUNT_OF_ECTS_POINTS_PER_MODULE =
#
MINIMAL_AMOUNT_OF_ECTS_POINTS_PER_MODULE
Define, in n ECTS, the minimum amount of ECTS points per module. A value of 5.0 or 6.0 seems a good number.
#
5.0
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
Studium::Colours::COLOURS
Class Method Summary
collapse
-
.[](i = '') ⇒ Object
# === Studium::CurriculumModuleDisplayer[] ========================================================================= #.
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, #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_arguments, #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 = nil, run_already = true) ⇒ CurriculumModuleDisplayer
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/studium/curricula/curriculum_module_displayer/initialize.rb', line 14
def initialize(
commandline_arguments = nil,
run_already = true
)
reset
set_commandline_arguments(
commandline_arguments
)
run if run_already
end
|
Class Method Details
.[](i = '') ⇒ Object
#
Studium::CurriculumModuleDisplayer[]
#
407
408
409
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 407
def self.[](i = '')
new(i)
end
|
Instance Method Details
#already_solved?(i) ⇒ Boolean
133
134
135
136
137
138
139
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 133
def already_solved?(i)
already_solved_or_not = false
if @dataset_from_the_file_lecture_information[i].has_key? :already_solved
already_solved_or_not = @dataset_from_the_file_lecture_information[i][:already_solved]
end
already_solved_or_not
end
|
#colour_for_ects_points(i) ⇒ Object
#
colour_for_ects_points
#
374
375
376
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 374
def colour_for_ects_points(i)
skyblue(i)
end
|
#colour_for_percentage_values(i) ⇒ Object
#
colour_for_percentage_values
#
381
382
383
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 381
def colour_for_percentage_values(i)
mediumseagreen(i)
end
|
#colour_for_university(i) ⇒ Object
#
colour_for_university
#
100
101
102
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 100
def colour_for_university(i)
olive(i)
end
|
#commandline_arguments? ⇒ Boolean
#
commandline_arguments?
#
49
50
51
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 49
def commandline_arguments?
@commandline_arguments
end
|
144
145
146
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 144
def dataset_from_the_file_lecture_information?
@dataset_from_the_file_lecture_information
end
|
#determine_which_curriculum_to_use(i = commandline_arguments?.first) ⇒ Object
#
determine_which_curriculum_to_use
#
362
363
364
365
366
367
368
369
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 362
def determine_which_curriculum_to_use(
i = commandline_arguments?.first
)
if i.nil? or i.empty?
i = :default
end
set_use_this_curriculum(i)
end
|
#do_prefer_english ⇒ Object
Also known as:
prefer_english
35
36
37
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 35
def do_prefer_english
@prefer_this_language_for_the_curriculum = :english
end
|
#do_show_only_the_modules ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/studium/curricula/curriculum_module_displayer/show_and_report.rb', line 19
def do_show_only_the_modules
e
@hash_keeping_the_modules.each {|this_name, array_these_lectures_are_part_of_that_module|
n_ects_points_in_this_module = 0
first_lecture = array_these_lectures_are_part_of_that_module.first
pointer = main_dataset?[first_lecture]
result = slateblue(this_name.rjust(3)).dup
if pointer.has_key? :name_of_the_curriculum_module
array_these_lectures_are_part_of_that_module.each {|this_lecture|
n_ects_points = main_dataset?[this_lecture][:ects]
n_ects_points_in_this_module += n_ects_points
}
title = pointer[:name_of_the_curriculum_module].strip
result << ' '+royalblue(title)+' '+
colour_for_ects_points(
n_ects_points_in_this_module.to_s+' ECTS'
)
end
e result
}
e
end
|
#has_a_dependency_on_a_prior_module?(this_lecture_dataset) ⇒ Boolean
#
has_a_dependency_on_a_prior_module?
This method will return true if the passed dataset has a dependency listed on a prior module.
We will also check for an individual curriculum here. If this exists then we will try to prefer the entry for this individual curriculum.
#
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 69
def has_a_dependency_on_a_prior_module?(this_lecture_dataset)
has_a_dependency = false if this_lecture_dataset
if is_an_individual_curriculum? and
this_lecture_dataset.has_key?(:individual_curriculum_depends_on_these_modules)
has_a_dependency = true
elsif this_lecture_dataset.has_key? :depends_on_these_modules
has_a_dependency = true
end
end
has_a_dependency
end
|
#has_description?(i) ⇒ Boolean
279
280
281
282
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 279
def has_description?(i)
@dataset_from_the_file_lecture_information[i].has_key?(:description_in_english) or
@dataset_from_the_file_lecture_information[i].has_key?(:description_in_german)
end
|
#is_an_individual_curriculum? ⇒ Boolean
#
is_an_individual_curriculum?
#
42
43
44
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 42
def is_an_individual_curriculum?
@is_an_individual_curriculum
end
|
#is_more_than_one_university_involved_in_this_curriculum? ⇒ Boolean
#
is_more_than_one_university_involved_in_this_curriculum?
This method will return true e. g. if it is an individual curriculum.
#
153
154
155
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 153
def is_more_than_one_university_involved_in_this_curriculum?
@hash_universities.keys.size > 1
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
|
# File 'lib/studium/curricula/curriculum_module_displayer/menu.rb', line 14
def (
i = commandline_arguments?
)
if i.is_a? Array
i.each {|entry| (entry) }
else
case i when /^-?-?overview$/i
(:default)
do_show_only_the_modules
exit
when /^-?-?show(_|-)?modules$/i
do_show_only_the_modules
exit
when /help$/i
show_help
exit
end
end
end
|
#notify_the_user_that_this_module_has_too_few_ects_points(name_of_the_module, n_ects) ⇒ Object
#
notify_the_user_that_this_module_has_too_few_ects_points
#
262
263
264
265
266
267
268
269
270
271
272
273
274
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 262
def notify_the_user_that_this_module_has_too_few_ects_points(
name_of_the_module,
n_ects
)
e
e 'Module '+sfancy(name_of_the_module)+' has too '\
'few ECTS points ('+
colourize_ects(n_ects.to_s+' ECTS points')+').'
e 'This is not allowed, as defined per the '\
'constant '+slateblue('ENSURE_MINIMUM_SIZE_OF_A_MODULE')+'.'
e 'Consider changing the composition of the module.'
e
end
|
#report(hash = @hash_keeping_the_modules) ⇒ Object
#
report (report tag)
This is the main report-method of this class. It will report the findings on the commandline to the end-user.
#
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
# File 'lib/studium/curricula/curriculum_module_displayer/show_and_report.rb', line 66
def report(
hash = @hash_keeping_the_modules
)
hash.each_pair {|name_of_the_module, array_these_lectures_are_part_of_that_module|
total_ects = return_n_ects_of_this_lecture(
array_these_lectures_are_part_of_that_module
)
e
e gold('Modul: '+name_of_the_module.ljust(12))+
colour_for_ects_points('[zu '+total_ects.to_s+' ECTS Punkten]')+
steelblue(
' ['+array_these_lectures_are_part_of_that_module.size.to_s+
' Lehrveranstaltungen in diesem Modul]'
)
if @ensure_minimum_size_of_a_module
if total_ects.to_f < MINIMAL_AMOUNT_OF_ECTS_POINTS_PER_MODULE
notify_the_user_that_this_module_has_too_few_ects_points(
name_of_the_module,
total_ects
)
exit
end
end
first_lecture = array_these_lectures_are_part_of_that_module.first
pointer = main_dataset?[first_lecture]
if pointer.has_key? :name_of_the_curriculum_module
title = pointer[:name_of_the_curriculum_module]
e " #{lightgreen('Name: ')}"\
"#{lightgreen(title.chomp)}" end
if @show_dependency_on_other_modules
if has_a_dependency_on_a_prior_module?(pointer)
if pointer[return_the_proper_module_dependency_entry]
e mediumturquoise(
' This module depends on these prior modules: '
)+
mediumseagreen(
pointer[return_the_proper_module_dependency_entry].join(', ').strip
)
end
end
end
e
array_these_lectures_are_part_of_that_module.each {|this_lecture|
n_ects = return_n_ects_of_this_lecture(this_lecture)
belongs_to_this_university = which_university?(this_lecture)
lecture_belongs_to_these_curricula = which_curricula?(this_lecture)
has_the_lecture_been_completed_already = already_solved?(this_lecture)
has_description = has_description?(this_lecture)
unless has_description
e crimson('No :description entry was found for ')+
sfancy(this_lecture)+crimson('.')
end
lecture_belongs_to_these_curricula.each {|this_curriculum_number|
@hash_ects_per_curriculum[this_curriculum_number] += n_ects
}
@n_ects_in_total += n_ects
@hash_universities[belongs_to_this_university] += n_ects
result = ' '+
royalblue(
this_lecture.ljust(90)
)+
colour_for_ects_points(
n_ects.to_s.rjust(4)+' ECTS'
) result << ' '+colour_for_university(
belongs_to_this_university.ljust(12)
)
if has_the_lecture_been_completed_already
result << lightgreen('[completed already]')
else
result << crimson('[not yet completed]')
end
e result
}
}
e
e "This curriculum has a total of "\
"#{colour_for_ects_points(@n_ects_in_total.to_s+' ECTS points')}."
e
report_average_module_size
report_university_attribution if @shall_we_report_university_attribution
end
|
#report_average_module_size ⇒ Object
#
report_average_module_size
#
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 85
def report_average_module_size
average_ects_points = 0
values = @hash_keeping_the_modules.values
values = values.map {|entry| return_n_ects_of_this_lecture(entry) }
average_ects_points = (
values.sum.to_f / values.size
).round(2).to_s
e "The average module size is: "\
"#{colourize_ects(average_ects_points.to_s+' ECTS points')}"
e
end
|
#report_university_attribution ⇒ Object
#
report_university_attribution
This method will report to which specific university the lectures belong to.
#
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 163
def report_university_attribution
e 'Of these lectures, the following university/universities '\
'are attributed:'
e
total_ects_points = total_ects_points?
sorted_hash = @hash_universities.sort_by {|key, n_ects_points|
n_ects_points
}.reverse
sorted_hash = Hash[*sorted_hash.flatten]
index = 0
sorted_hash.each_pair {|name_of_the_university, n_ects_points| index += 1
percent_value = (
(n_ects_points * 100 ) / total_ects_points
).round(2)
percent_value = '%.2f' % percent_value.to_f
percentage_value_as_string = (
percent_value.to_s+'%'
).rjust(6)
padded_index = '('+index.to_s+') '
colourized_and_padded_index = mediumspringgreen(padded_index)
e ' '+
colourized_and_padded_index+
colour_for_university(name_of_the_university.ljust(14))+' '+
colourize_ects(n_ects_points.to_s.rjust(5)+' ECTS points')+' '+
colour_for_percentage_values(
'('+percentage_value_as_string+')'
)
}
e
if is_more_than_one_university_involved_in_this_curriculum?
sorted = @hash_ects_per_curriculum.sort_by {|curriculum_id, n_ects_points|
n_ects_points
}.reverse
sorted = Hash[*sorted.flatten]
sorted.reject! {|a,b|
a.start_with?('1') or (a.size < 4)
}
e 'More than one university is involved with this curriculum. '\
'Thus, we will show the'
e 'ECTS attribution to each respective curriculum AND the '\
'associated university next:'
e
sorted.each_pair {|curriculum_id, n_ects_points|
n_percentage = (
(n_ects_points * 100) / total_ects_points?
).round(2).to_s
n_percentage = '%.2f' % n_percentage
belongs_to_this_curriculum = Studium.curriculum_id_to_curriculum_name(curriculum_id)
at_this_university = Studium.curriculum_id_to_university(curriculum_id)
e ' '+lightgreen(curriculum_id)+
': '+colour_ects(n_ects_points.to_s.rjust(5))+' '+
colour_for_percentage_values(
n_percentage.to_s.rjust(5)+'%'
)+
slateblue(
' ['+at_this_university.to_s.center(12)+']'
)+ ' (from curriculum '+sfancy(belongs_to_this_curriculum)+')' }
e
end
end
|
#reset ⇒ 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
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
|
# File 'lib/studium/curricula/curriculum_module_displayer/reset.rb', line 14
def reset
super()
@namespace = NAMESPACE
@ensure_minimum_size_of_a_module = ENSURE_MINIMUM_SIZE_OF_A_MODULE
@dataset_from_the_file_lecture_information = return_dataset_from_the_file_lecture_information
@hash_ects_per_curriculum = {} @hash_ects_per_curriculum.default = 0
@hash_keeping_the_modules = {}
@n_ects_in_total = 0
@hash_universities = {}
@hash_universities.default = 0
@is_an_individual_curriculum = false
@use_this_module_entry = :module
@show_dependency_on_other_modules = true
@prefer_this_language_for_the_curriculum = :german
@shall_we_report_university_attribution = true
end
|
#return_n_ects_of_this_lecture(i) ⇒ Object
#
return_n_ects_of_this_lecture
This method will always return a number (a Float).
#
109
110
111
112
113
114
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 109
def return_n_ects_of_this_lecture(i)
i = [i].flatten.compact
i.map {|entry|
@dataset_from_the_file_lecture_information[entry][:ects].to_f
}.sum
end
|
#return_the_proper_module_dependency_entry ⇒ Object
#
return_the_proper_module_dependency_entry
This method must return the proper module-dependency entry.
#
251
252
253
254
255
256
257
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 251
def return_the_proper_module_dependency_entry
if is_an_individual_curriculum?
:individual_curriculum_depends_on_these_modules
else
:depends_on_these_modules
end
end
|
#run ⇒ Object
14
15
16
17
18
|
# File 'lib/studium/curricula/curriculum_module_displayer/run.rb', line 14
def run
report
end
|
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
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 287
def (
i = commandline_arguments?.first
)
determine_which_curriculum_to_use(i)
array_all_lectures = return_lectures_from_this_curriculum(
@use_this_curriculum
)
array_all_lectures.map! {|entry|
[
entry,
@dataset_from_the_file_lecture_information[entry]
]
}
array_all_lectures.each {|name_of_the_lecture, inner_dataset|
if name_of_the_lecture
name_of_the_lecture.squeeze!(' ')
end
if inner_dataset.nil?
opnn; e "#{steelblue(nil)} value for the lecture "\
"#{sfancy(name_of_the_lecture)}"\
", at the variable inner_dataset."
next
end
use_this_module_entry = use_which_module_entry?
case use_this_module_entry
when :bachelor_vektor_curriculum,
:master_vektor_curriculum
use_this_module_entry = :individual_curricula
end
if inner_dataset.has_key? use_this_module_entry
_ = inner_dataset[use_this_module_entry]
first_entry = _.first
name_of_the_module = first_entry
if @hash_keeping_the_modules.has_key? name_of_the_module
@hash_keeping_the_modules[name_of_the_module] << name_of_the_lecture
else
@hash_keeping_the_modules[name_of_the_module] = [name_of_the_lecture]
end
else
opnn; e 'No module entry for `'+sfancy(name_of_the_lecture)+'`.'
e 'Also showing the data associated with this lecture:'
pp inner_dataset
e "The name of the module would have been: "\
"#{orange(use_this_module_entry.to_s)}"
end
}
end
|
#set_use_this_curriculum(i = :default) ⇒ Object
#
set_use_this_curriculum
#
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
|
# File 'lib/studium/curricula/curriculum_module_displayer/set_use_this_curriculum.rb', line 14
def set_use_this_curriculum(
i = :default
)
case i
when :default, nil
i = DEFAULT_CURRICULUM_TO_USE
end
case i.to_sym when :genetik,
:genetic,
:genetics
i = :genetik_curriculum
else
case i when /^-?-?boku(_|-)?bachelor(_|-)?individuelles(_|-)?curriculum$/i
i = :individuelles_curriculum_bachelor_boku
set_use_this_module_entry(i)
when /^-?-?bvek$/i,
/^-?-?bvektor$/i
i = :individuelles_curriculum_bachelor_vektor
set_use_this_module_entry(i)
when /^-?-?master$/i,
/^-?-?mvek$/i, /^-?-?mvec$/i i = :individuelles_curriculum_master_vektor
set_use_this_module_entry(i)
else
if i.to_s.include?('vektor') or
i.to_s.include?('vekcor')
name_of_the_curriculum = i.to_s.delete('-')
do_prefer_english if name_of_the_curriculum.start_with? 'm' i = :master_vektor_curriculum
elsif name_of_the_curriculum.start_with? 'bm'
i = :bachelor_master_vektor_curriculum
else
i = :bachelor_vektor_curriculum
end
set_use_this_module_entry(i)
end
end
end
@use_this_curriculum = i
end
|
#set_use_this_module_entry(i = :individual_curriculum_module) ⇒ Object
#
set_use_this_module_entry
#
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 388
def set_use_this_module_entry(
i = :individual_curriculum_module
)
case i
when :individual_curriculum_module,
:master_vektor_curriculum,
:bachelor_vektor_curriculum,
:individuelles_curriculum_bachelor_boku
@is_an_individual_curriculum = true
end
@use_this_module_entry = i
end
|
#show_help ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/studium/curricula/curriculum_module_displayer/show_and_report.rb', line 45
def show_help
e
e 'These curricula are especially important:'
e
e ' --genetik'
e ' --bvektor'
e ' --mvektor'
e ' --bmvektor'
e
e 'Furthermore, you can show a short summary over the modules, via:'
e
e ' --overview'
e
end
|
#total_ects_points? ⇒ Boolean
242
243
244
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 242
def total_ects_points?
@n_ects_in_total
end
|
#use_which_module_entry? ⇒ Boolean
#
use_which_module_entry?
#
56
57
58
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 56
def use_which_module_entry?
@use_this_module_entry
end
|
#which_curricula?(i) ⇒ Boolean
126
127
128
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 126
def which_curricula?(i)
@dataset_from_the_file_lecture_information[i]['curricula']
end
|
#which_university?(i) ⇒ Boolean
119
120
121
|
# File 'lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb', line 119
def which_university?(i)
@dataset_from_the_file_lecture_information[i][:university].to_s
end
|