Class: Studium::ShowLectures
- Inherits:
-
Base
- Object
- Base
- Studium::ShowLectures
show all
- Defined in:
- lib/studium/utility_scripts/show_lectures/run.rb,
lib/studium/utility_scripts/show_lectures/help.rb,
lib/studium/utility_scripts/show_lectures/menu.rb,
lib/studium/utility_scripts/show_lectures/misc.rb,
lib/studium/utility_scripts/show_lectures/reset.rb,
lib/studium/utility_scripts/show_lectures/constants.rb,
lib/studium/utility_scripts/show_lectures/initialize.rb,
lib/studium/utility_scripts/show_lectures/show_lectures.rb
Overview
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::ShowLectures[] ========================================================================= #.
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?, #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(i = nil, run_already = true) ⇒ ShowLectures
14
15
16
17
18
19
20
21
|
# File 'lib/studium/utility_scripts/show_lectures/initialize.rb', line 14
def initialize(
i = nil,
run_already = true
)
reset
parse_and_set_commandline(i)
run if run_already
end
|
Class Method Details
.[](i = '') ⇒ Object
#
Studium::ShowLectures[]
#
377
378
379
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 377
def self.[](i = '')
new(i)
end
|
Instance Method Details
#add_total_amount_of_ects_points_in_the_selected_lectures ⇒ Object
#
add_total_amount_of_ects_points_in_the_selected_lectures
#
147
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 147
def add_total_amount_of_ects_points_in_the_selected_lectures
@result << "In total there are "\
"#{sfancy(@n_ects_in_total_of_the_selected_lectures)} ECTS "\
"points available in the "\
"#{slateblue(@n_lectures_are_registered)} lectures "\
"shown above.#{N}"
end
|
#
To invoke this do, for example, the following:
timmuno --timetable
#
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
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 104
def consider_showing_the_timetable(
do_show_all_courses_belonging_to_this_theme = true
)
if @show_timetable
_ = Studium::ShowLecturesOnTheCommandline.new(:do_not_run_yet)
_.set_title('Theme: '+theme?.capitalize)
_.do_not_show_loaded_from_which_file
if do_show_all_courses_belonging_to_this_theme
use_this_selection = @selection.keys
else
use_this_selection = @selection.select {|key, value|
value[:already_solved] == false
}.keys
end
_.set_all_lectures(use_this_selection)
_.do_generate_a_html_file
end
end
|
#considering_showing_how_many_ects_points_were_successfully_passed_in_total ⇒ Object
#
considering_showing_how_many_ects_points_were_successfully_passed_in_total
This method will simply show how many ECTS points were passed fitting to the given theme at hand.
#
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 166
def considering_showing_how_many_ects_points_were_successfully_passed_in_total
if @n_ects_were_successfully_passed_in_total > 0
@result = "Passed a total of "\
"#{sfancy(@n_ects_were_successfully_passed_in_total.to_s.rjust(@n_ects_in_total_of_the_selected_lectures.to_s.size + 1))}"\
" ECTS points, in #{royalblue(@n_lectures_were_successfully_passed_in_total)} "\
"different courses, fitting "\
"to the theme\n".dup
@result << "`#{slategray(which_theme?)}`".dup
average_grade_is = (
@array_grades.sum / @array_grades.size
).round(2)
@result << mediumslateblue(' (Average grade: ')+
forestgreen(average_grade_is.to_s)+
mediumslateblue(')')
@result << ".#{N}"
end
end
|
#do_show_only_solved_lectures ⇒ Object
#
do_show_only_solved_lectures
#
140
141
142
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 140
def do_show_only_solved_lectures
@show_these_lectures = :only_solved_lectures
end
|
#do_show_only_unsolved_lectures ⇒ Object
#
do_show_only_unsolved_lectures
#
87
88
89
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 87
def do_show_only_unsolved_lectures
@show_these_lectures = :show_only_unsolved_lectures
end
|
63
64
65
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 63
def input?
@commandline
end
|
70
71
72
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 70
def input_theme?
@input_theme
end
|
79
80
81
82
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 79
def load_dataset_from_the_file_lecture_information
@dataset_from_file_lecture_information =
return_sanitized_dataset_from_the_file_lecture_information
end
|
#main_dataset? ⇒ Boolean
94
95
96
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 94
def main_dataset?
@selection
end
|
12
13
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
|
# File 'lib/studium/utility_scripts/show_lectures/menu.rb', line 12
def (
i = @commandline
)
if i.is_a? Array
i.each {|entry| (entry) }
else
case i
when /-?-?show(-|_)?solved(-|_)?lectures$/i,
/-?-?show(-|_)?only(-|_)?solved(-|_)?lectures$/i,
/-?-?only(-|_)?solved$/i,
/-?-?only(-|_)?completed$/i,
/-?-?completed$/i,
/-?-?solved$/i,
/-?-?finished$/i,
/-?-?passed$/i,
/-?-?passed(-|_)?only$/i
do_show_only_solved_lectures
when /-?-?only(-|_)?unsolved$/i,
/-?-?unsolved$/i,
/-?-?todo$/i,
/-?-?unfinished$/i
do_show_only_unsolved_lectures
when /^-?-?boku$/i
@show_only_courses_at_this_university = :boku
when /^-?-?bachelor$/,
/^-?-?only(-|_)?bachelor$/
@show_what = :bachelor
when /^-?-?master$/,
/^-?-?only(-|_)?master$/
@show_what = :master
when /^-?-?timetable$/,
/^-?-?upcoming$/
@show_timetable = true
when /^-?-?n(-|_)?ECTS=(.+)$/i
search_for_n_ects = $2.to_s.to_f
@dataset_from_file_lecture_information.select! {|a,b|
b[:ects] == search_for_n_ects
}
when /help$/i
show_help
exit
else
opnn; e "Not known input `#{sfancy(i)}`."
end
end
end
|
#n_ects_were_successfully_passed_in_total? ⇒ Boolean
Also known as:
n_ects_were_passed_in_this_curriculum
#
n_ects_were_successfully_passed_in_total?
#
133
134
135
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 133
def n_ects_were_successfully_passed_in_total?
@n_ects_were_successfully_passed_in_total
end
|
361
362
363
364
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 361
def
e; opnn; e 'These lectures were found to fit to the input-theme `'+
sfancy(input_theme?)+'`:'; e
end
|
#obtain_all_lectures_that_belong_to_the_given_theme_at_hand ⇒ Object
#
obtain_all_lectures_that_belong_to_the_given_theme_at_hand
This is the method that will select all the lectures that fit to the target theme at hand.
#
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 197
def obtain_all_lectures_that_belong_to_the_given_theme_at_hand
_ = @dataset_from_file_lecture_information
we_seek_this_theme = searching_for_this_theme?
we_seek_this_theme = we_seek_this_theme.first if we_seek_this_theme.is_a? Array
case @show_these_lectures
when :show_only_solved_lectures,
:only_solved_lectures
_.select! {|name_of_the_lecture, hash_containing_lots_of_data|
already_solved = hash_containing_lots_of_data[:already_solved]
(already_solved == true)
}
when :show_only_unsolved_lectures,
:only_unsolved_lectures
_.select! {|name_of_the_lecture, hash_containing_lots_of_data|
already_solved = hash_containing_lots_of_data[:already_solved]
!already_solved
}
end
selection = _.reject {|a, b|
b.has_key?(:outdated_lecture) and
(b[:outdated_lecture] == true) and
(b[:outdated_lecture] == true) and
!(b[:already_solved] == true)
}
@selection = selection.select {|name_of_the_lecture, hash_containing_lots_of_data|
if hash_containing_lots_of_data.has_key? 'themes'
themes = hash_containing_lots_of_data['themes'].compact
if themes.nil? or themes.empty?
opnn; e swarn('Warning:')+' the lecture '+sfancy(name_of_the_lecture)+
' has no logical "themes:" entry.'
end
end
if themes
mapped_themes = themes.map {|inner_line|
if inner_line.nil?
e 'Nil value - something is wrong.'
e
e 'Showing themes next:'
e
pp themes
e
e 'Next showing @selection:'
e
@selection
end
inner_line.delete(' ')
}
if mapped_themes.include? we_seek_this_theme.to_s.delete('_ ')
name_of_the_lecture
end
end
}
end
|
#parse_and_set_commandline(i = '') ⇒ Object
#
parse_and_set_commandline
#
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/utility_scripts/show_lectures/misc.rb', line 16
def parse_and_set_commandline(i = '')
if i.is_a?(String) and i.include?('--')
i = i.split('--').map {|line| "--#{line}" }.reject {|entry| entry == '--' }
end
unless i.is_a? Array i = [i]
end
use_this_theme = nil
i.map! {|line|
line = line.to_s.dup
unless line.include? '--'
use_this_theme = line
end
line.delete!('-') line.downcase! unless line.include? '+'
line = Studium.sanitize_this_theme_topic(line) line
}
use_this_theme = i.shift if use_this_theme.nil?
set_input_theme(use_this_theme) @commandline = i
end
|
#report_the_result_on_the_commandline ⇒ Object
#
report_the_result_on_the_commandline
#
354
355
356
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 354
def report_the_result_on_the_commandline
e @result unless @result.empty?
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/studium/utility_scripts/show_lectures/reset.rb', line 14
def reset
super()
@namespace = NAMESPACE
@n_lectures_are_registered = 0
@result = ''.dup
@show_timetable = false
@selection = nil
@dataset_from_file_lecture_information = nil
@n_lectures_were_successfully_passed_in_total = 0
@n_ects_in_total_of_the_selected_lectures = 0
@n_ects_were_successfully_passed_in_total = 0
@show_only_courses_at_this_university = nil
@array_grades = []
@show_these_lectures = :all
@show_what = :bachelor_and_master_and_unattributed_lectures end
|
#run ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/studium/utility_scripts/show_lectures/run.rb', line 14
def run
load_dataset_from_the_file_lecture_information
obtain_all_lectures_that_belong_to_the_given_theme_at_hand
show_this_hash(
:default, :split_into_bachelor_and_master_lectures
)
considering_showing_how_many_ects_points_were_successfully_passed_in_total
add_total_amount_of_ects_points_in_the_selected_lectures
report_the_result_on_the_commandline
consider_showing_the_timetable end
|
#
Do some sanitizing of the theme here.
#
50
51
52
53
54
55
56
57
58
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 50
def set_input_theme(i)
case i when 'bioprozesstechnik'
i = 'bioprocess engineering'
when 'immuno','immunologie'
i = 'immunology'
end
@input_theme = i
end
|
#show_help ⇒ Object
#
show_help (help tag)
Invocation example for this method:
tbiochem --help
#
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/studium/utility_scripts/show_lectures/help.rb', line 19
def show_help
help_string = <<-EOF
--timetable # show upcoming exams belonging to that topic at hand
--only-unsolved # show only unsolved lectures
# (that were not yet completed successfully)
--n-ECTS=NUMBER # show only lectures with n ECTS points
--only-master # show only master lectures, thus ignoring only bachelor-lectures
--boku # show only lectures that are offered at the BOKU (university)
--only-completed # show only passed lectures; note that --completed or --passed-only are alias to this
EOF
e help_string
end
|
#show_this_hash(hash = @selection, optional_argument_controlling_what_we_will_report_here = nil) ⇒ Object
Also known as:
show_hash
#
show_this_hash
The first argument to this method should be a Hash. This Hash will then be properly formatted and displayed.
The second argument to this method is a controller - it can control whether we want to split up the display into, for example, Bachelor and Master-lectures. That is, lectures that are attributed to the corresponding bachelor or master curriculum. This allows us to group lectures to specific curricula.
#
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 393
def show_this_hash(
hash = @selection,
optional_argument_controlling_what_we_will_report_here = nil
)
case hash
when :default
hash = @selection
end
if hash.empty?
opnn; e 'No result was found for the given input-theme '+
'`'+sfancy(input_theme?.to_s)+'`'
else @n_lectures_are_registered = hash.keys.size
shall_we_make_use_of_unicode_symbols = Studium.shall_we_make_use_of_unicode_symbols?
if optional_argument_controlling_what_we_will_report_here
case optional_argument_controlling_what_we_will_report_here
when :split_into_bachelor_and_master_lectures
show_this_hash_split_into_bachelor_and_master_lectures(hash)
end
else hash.reject! {|name_of_the_lecture, inner_hash|
if @show_only_courses_at_this_university
this_university = inner_hash[:university].to_s.downcase.delete(' ')
!this_university.start_with?(@show_only_courses_at_this_university.to_s.downcase)
else
false
end
}
unless hash.empty?
end
index = 0
hash.each_pair {|name_of_the_lecture, inner_hash| index += 1
splitted = name_of_the_lecture.split(' ')
lva_id = splitted.first
real_name = splitted[1..-1].join(' ')
n_ects_points = inner_hash[:ects].to_f
if inner_hash.has_key? :semester
which_semester = inner_hash[:semester]
else
which_semester = ''
end
@n_ects_in_total_of_the_selected_lectures += n_ects_points
array_curricula = inner_hash['curricula']
lecture_type = inner_hash[:type]
already_solved = inner_hash[:already_solved]
if already_solved
passed_this_exam_on = inner_hash[:already_solved_at]
@n_lectures_were_successfully_passed_in_total += 1
@n_ects_were_successfully_passed_in_total += n_ects_points
@array_grades << inner_hash[:grade].to_f
else
passed_this_exam_on = nil
end
at_this_university = inner_hash[:university]
if array_curricula.nil?
opnn; e "The lecture #{sfancy(name_of_the_lecture)} has "\
"no curricula-entry associated."
opnn; e 'The associated Hash will also be shown next.'
pp inner_hash
end
if passed_this_exam_on.nil? or (passed_this_exam_on == false)
colourized_index = orange(
("(#{index.to_s})").rjust(4).ljust(5)
)
else
colourized_index = tan(
("(#{index.to_s})").rjust(4).ljust(5)
)
end
case which_semester
when 'winter'
which_semester = 'WS'
when 'summer'
which_semester = 'SS'
when 'both'
which_semester = 'WS/SS'
end
result = "#{colourized_index} ".dup
if already_solved
result << darkolivegreen(name_of_the_lecture)
else
result << olivedrab(name_of_the_lecture)
end
result << ' '+plum('(n ECTS: '+n_ects_points.to_s+'; ')+
forestgreen(lecture_type).dup
unless which_semester.empty?
result << "; #{orange(which_semester)}"
end
result << plum(')')+ peru(' (Universität: ')+
springgreen(at_this_university)+
peru(')')
e result
if already_solved.nil? or (already_solved == false)
already_solved = Studium.already_solved_this_lva_number?(lva_id, real_name)
end
if already_solved
if passed_this_exam_on.nil? or (passed_this_exam_on == false)
passed_this_exam_on = Studium.passed_this_exam_on(name_of_the_lecture)
end
if passed_this_exam_on.nil? or (passed_this_exam_on == false) opnn; e swarn('An error occurred for the lecture called ')+
sfancy(name_of_the_lecture)
opnn; e "#{swarn('It failed in the method ')}"\
"#{sfancy('Studium.passed_this_exam_on(name_of_the_lecture)')}"
opnn; e swarn('Please correct this error. Different reasons can be')
opnn; e swarn('as to why this has failed. One may be trailing space')
opnn; e swarn('characters in the .csv that keeps your passed exams.')
else
completed_successfully_msg = (' ' * 6).dup
if shall_we_make_use_of_unicode_symbols and
Object.const_defined?(:Roebe) and
Roebe.respond_to?(:to_unicode)
completed_successfully_msg << swarn(Roebe.to_unicode(:thick))
end
completed_successfully_msg << lightblue(' ☺ ')+ swarn(' ^^^ COMPLETED SUCCESSFULLY ON THE ')+
coral(passed_this_exam_on.to_s)+swarn(' ^^^')
e completed_successfully_msg
end
end
array_curricula.each {|this_curriculum|
name_of_the_curriculum = Studium.return_name_of_this_curriculum(this_curriculum)
e (' ' * 6)+' '+
mediumaquamarine(this_curriculum.ljust(6))+
royalblue(' # ')+
slateblue(name_of_the_curriculum)
}
}; e
end
end
end
|
#show_this_hash_split_into_bachelor_and_master_lectures(i) ⇒ Object
#
show_this_hash_split_into_bachelor_and_master_lectures
#
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
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 284
def show_this_hash_split_into_bachelor_and_master_lectures(i)
hash_holding_all_bachelor_lectures = {}
hash_holding_all_master_lectures = {}
hash_holding_all_non_unattributed_lectures = {}
i.each_pair {|name_of_the_lecture, inner_hash|
curricula = inner_hash['curricula']
if curricula.any? {|curriculum_number|
curriculum_number.start_with? '033' }
hash_holding_all_bachelor_lectures[name_of_the_lecture] = inner_hash
elsif curricula.any? {|curriculum_number|
curriculum_number.start_with? '066' }
hash_holding_all_master_lectures[name_of_the_lecture] = inner_hash
else hash_holding_all_non_unattributed_lectures[name_of_the_lecture] = inner_hash
end
}
case @show_what
when :bachelor
verbose_show_these_bachelor_lectures(hash_holding_all_bachelor_lectures)
when :master
verbose_show_these_master_lectures(hash_holding_all_master_lectures)
when :bachelor_and_master
verbose_show_these_bachelor_lectures(hash_holding_all_bachelor_lectures)
verbose_show_these_master_lectures(hash_holding_all_master_lectures)
when :bachelor_and_master_and_unattributed_lectures
verbose_show_these_bachelor_lectures(hash_holding_all_bachelor_lectures)
verbose_show_these_master_lectures(hash_holding_all_master_lectures)
verbose_show_these_unattributed_lectures(hash_holding_all_non_unattributed_lectures)
end
end
|
#verbose_show_these_bachelor_lectures(i) ⇒ Object
#
verbose_show_these_bachelor_lectures
#
369
370
371
372
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 369
def verbose_show_these_bachelor_lectures(i)
opnn; e "First showing all #{khaki('bachelor-lectures')}:"
show_hash(i)
end
|
#verbose_show_these_master_lectures(i) ⇒ Object
#
verbose_show_these_master_lectures
#
346
347
348
349
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 346
def verbose_show_these_master_lectures(i)
opnn; e "Next showing all #{khaki('master-lectures')}:"
show_hash(i)
end
|
#verbose_show_these_unattributed_lectures(i) ⇒ Object
#
verbose_show_these_unattributed_lectures
#
336
337
338
339
340
341
|
# File 'lib/studium/utility_scripts/show_lectures/misc.rb', line 336
def verbose_show_these_unattributed_lectures(i)
unless i.empty?
opnn; e "Next showing all #{khaki('unattributed-lectures')}:"
show_hash(i)
end
end
|