Class: Studium::ExamsPerMonth
- Inherits:
-
Base
- Object
- Base
- Studium::ExamsPerMonth
show all
- Defined in:
- lib/studium/exams/exams_per_month/exams_per_month.rb
Overview
Constant Summary
collapse
- TITLE =
'Exams per Month'
- LAST_YEAR =
Time.now.year
- N_LJUST =
82
- SHOW_N_BEST_MONTHS =
#
SHOW_N_BEST_MONTHS
Determine how many “best months” to show, by default.
#
30
- ARRAY_REGISTERED_MONTHS =
#
ARRAY_REGISTERED_MONTHS
The months are stored in both the german and the english language.
#
%w(
januar
februar
feb
märz
april
mai
juni
juli
august
september
oktober
november
dezember
january
february
march
april
may
june
july
october
december
)
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
-
#calculate_the_average_amount_per_passed_exam ⇒ Object
# === calculate_the_average_amount_per_passed_exam ========================================================================= #.
-
#colour_for_hours(i) ⇒ Object
(also: #colourize_hours)
# === colour_for_hours.
-
#colourize_ects_points(i) ⇒ Object
(also: #colourize_ects, #colour_ects)
# === colourize_ects_points.
-
#colourize_month_year(i) ⇒ Object
# === colourize_month_year.
-
#colourize_n_exams(i, use_this_colour = :lightslategray) ⇒ Object
# === colourize_n_exams.
-
#colourize_year(i) ⇒ Object
# === colourize_year ========================================================================= #.
-
#current_year? ⇒ Boolean
(also: #current_year)
# === current_year? ========================================================================= #.
-
#dataset? ⇒ Boolean
# === dataset? ========================================================================= #.
-
#determine_n_ects_points_in_total ⇒ Object
# === determine_n_ects_points_in_total.
-
#determine_n_exams_in_total_were_passed ⇒ Object
# === determine_n_exams_in_total_were_passed ========================================================================= #.
-
#determine_n_hours_were_passed_in_total ⇒ Object
# === determine_n_hours_were_passed_in_total ========================================================================= #.
-
#do_show_ects_points ⇒ Object
# === do_show_ects_points ========================================================================= #.
-
#do_show_only_grade_for(i = nil) ⇒ Object
# === do_show_only_grade_for ========================================================================= #.
-
#do_show_only_this_year_here(i) ⇒ Object
# === do_show_only_this_year_here.
-
#do_show_the_grades_statistics ⇒ Object
# === do_show_the_grades_statistics.
-
#do_show_yearly_average_grades ⇒ Object
# === do_show_yearly_average_grades ========================================================================= #.
-
#draw_image_with_gruff ⇒ Object
# === draw_image_with_gruff.
-
#file_lecture_information?(_ = Studium.file_lecture_information) ⇒ Boolean
-
#initialize(commandline_arguments = nil, run_already = true) ⇒ ExamsPerMonth
constructor
# === initialize ========================================================================= #.
-
#input? ⇒ Boolean
-
#is_this_sommersemester_or_wintersemester?(i) ⇒ Boolean
# === is_this_sommersemester_or_wintersemester?.
-
#last_year? ⇒ Boolean
(also: #last_year)
# === last_year? ========================================================================= #.
-
#main_file? ⇒ Boolean
# === main_file? ========================================================================= #.
-
#menu(i = input? ) ⇒ Object
(also: #check_against_menu)
-
#menu_file? ⇒ Boolean
-
#n_exams_passed?(for_this_year = @current_year) ⇒ Boolean
# === n_exams_passed? ========================================================================= #.
-
#obtain_dataset(use_this_file = main_file? ) ⇒ Object
# === obtain_dataset.
-
#open_result_in_gimp ⇒ Object
# === open_result_in_gimp.
-
#open_the_curricula_assigned_exams_file_in_the_editor ⇒ Object
# === open_the_curricula_assigned_exams_file_in_the_editor ========================================================================= #.
-
#open_the_file_lecture_information_in_the_editor(i = file_lecture_information? ) ⇒ Object
-
#open_the_main_file_in_the_editor ⇒ Object
# === open_the_main_file_in_the_editor ========================================================================= #.
-
#open_the_main_files_in_the_editor ⇒ Object
# === open_the_main_files_in_the_editor (open tag).
-
#open_the_menu_file_in_the_editor ⇒ Object
-
#output_colourized_year_and_colourized_hours(year) ⇒ Object
# === output_colourized_year_and_colourized_hours ========================================================================= #.
-
#output_the_csv_file ⇒ Object
# === output_the_csv_file.
-
#raw_dataset?(use_this_file = main_file? ) ⇒ Boolean
# === raw_dataset?.
-
#report_how_many_ects_points_have_been_gathered_so_far(n_ljust = N_LJUST) ⇒ Object
# === report_how_many_ects_points_have_been_gathered_so_far ========================================================================= #.
-
#report_how_many_exams_were_passed_in_total(i = @n_exams_in_total_passed, ljust_n_times = N_LJUST, n_rjust = 4) ⇒ Object
# === report_how_many_exams_were_passed_in_total ========================================================================= #.
-
#report_how_many_hours_were_passed_in_total(i = @n_hours_passed_in_total, n_ljust = N_LJUST, n_rjust = 6) ⇒ Object
# === report_how_many_hours_were_passed_in_total.
-
#report_how_many_of_these_ects_points_required_mandatory_presence(n_ects_points_in_mandatory_presence_courses = Studium.n_ects_points_in_mandatory_presence_courses, n_ljust = N_LJUST) ⇒ Object
# === report_how_many_of_these_ects_points_required_mandatory_presence.
-
#report_month_year_hours_ects_n_exams_passed_in_this_month(month, year, n_hours, n_ECTS, n_exams_passed_in_this_month) ⇒ Object
# === report_month_year_hours_ects_n_exams_passed_in_this_month ========================================================================= #.
-
#report_the_average_amount_of_ects_per_passed_exam(ects_per_exams_passed = calculate_the_average_amount_per_passed_exam, ljust_n_times = N_LJUST, rjust_n_times = 12) ⇒ Object
# === report_the_average_amount_of_ects_per_passed_exam ========================================================================= #.
-
#report_the_average_grade(n_ljust = N_LJUST, n_rjust = 4) ⇒ Object
# === report_the_average_grade.
-
#report_total_amount_of_ects_points(total_ects_points, bachelor_or_master = :bachelor, ljust_to_use = 41) ⇒ Object
# === report_total_amount_of_ects_points ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#reset_ects_points ⇒ Object
(also: #reset_ects)
# === reset_ects_points ========================================================================= #.
-
#reset_main_hash ⇒ Object
# === reset_main_hash ========================================================================= #.
-
#reset_n_hours ⇒ Object
(also: #reset_hours)
# === reset_n_hours ========================================================================= #.
-
#run ⇒ Object
# === run ========================================================================= #.
-
#sanitize_dataset(i = dataset?, , modify_time_entry = true) ⇒ Object
# === sanitize_dataset.
-
#set_current_year(i = Time.now.strftime('%Y').to_i) ⇒ Object
# === set_current_year.
-
#set_dataset(i) ⇒ Object
# === set_dataset ========================================================================= #.
-
#set_input(i = nil) ⇒ Object
-
#set_last_year(i = current_year?) ) ⇒ Object
# === set_last_year ========================================================================= #.
-
#set_n_ects_points_in_total(i) ⇒ Object
# === set_n_ects_points_in_total ========================================================================= #.
-
#set_n_exams_in_total_passed(i) ⇒ Object
# === set_n_exams_in_total_passed ========================================================================= #.
-
#set_store_where(i) ⇒ Object
# === set_store_where ========================================================================= #.
-
#show_all_exams_from_this_month(i = 'januar') ⇒ Object
# === show_all_exams_from_this_month.
-
#show_best_months(do_show_n_months = @show_n_best_months) ⇒ Object
# === show_best_months.
-
#show_colourized_line(n_times = 34) ⇒ Object
# === show_colourized_line ========================================================================= #.
-
#show_ects_passed_per_university ⇒ Object
# === show_ects_passed_per_university ========================================================================= #.
-
#show_ects_points? ⇒ Boolean
# === show_ects_points? ========================================================================= #.
-
#show_exam_ects_points_passed_per_semester ⇒ Object
# === show_exam_ects_points_passed_per_semester ========================================================================= #.
-
#show_half_split_exams_per_year ⇒ Object
# === show_half_split_exams_per_year.
-
#show_help ⇒ Object
# === show_help (help tag).
-
#show_how_many_exams_we_have_passed_in_this_curriculum(i) ⇒ Object
# === show_how_many_exams_we_have_passed_in_this_curriculum.
-
#show_n_exams_passed_per_month(i = @hash) ⇒ Object
(also: #report_main_hash, #report)
# === show_n_exams_passed_per_month (report tag).
-
#show_number_then_name_of_the_lecture_then_n_ECTS_points_then_leistung_erbracht_then_which_university(index, name_of_the_lecture, n_ects, leistung_erbracht_am, which_university) ⇒ Object
# === show_number_then_name_of_the_lecture_then_n_ECTS_points_then_leistung_erbracht_then_which_university.
-
#show_numbered_exams(normal_or_reversed = :normal) ⇒ Object
# === show_numbered_exams.
-
#show_only_bachelor_exams ⇒ Object
# === show_only_bachelor_exams.
-
#show_only_bachelor_lectures ⇒ Object
# === show_only_bachelor_lectures.
-
#show_only_exams_at_the_boku ⇒ Object
# === show_only_exams_at_the_boku.
-
#show_only_exams_at_the_meduni ⇒ Object
# === show_only_exams_at_the_meduni.
-
#show_only_exams_at_the_tu ⇒ Object
# === show_only_exams_at_the_tu.
-
#show_only_exams_at_the_uniwien ⇒ Object
# === show_only_exams_at_the_uniwien.
-
#show_only_exams_at_the_vetmed_uni ⇒ Object
# === show_only_exams_at_the_vetmed_uni.
-
#show_only_exams_before_this_date(this_date) ⇒ Object
# === show_only_exams_before_this_date.
-
#show_only_exams_past_this_date(this_date) ⇒ Object
# === show_only_exams_past_this_date.
-
#show_only_master_lectures ⇒ Object
# === show_only_master_lectures.
-
#show_only_practical_courses_that_were_passed_already ⇒ Object
# === show_only_practical_courses_that_were_passed_already.
-
#show_the_summary ⇒ Object
(also: #show_only_the_summary)
# === show_the_summary.
-
#show_the_years_in_a_short_table_overview ⇒ Object
# === show_the_years_in_a_short_table_overview.
-
#show_total_summary_for_year_hours_ects_n_exams(last_year, total_n_hours_passed_in_this_year, total_n_ects_passed_in_this_year, total_n_exams_passed_in_this_year, optional_average_grade_per_exam = nil) ⇒ Object
# === show_total_summary_for_year_hours_ects_n_exams.
-
#store_result ⇒ Object
# === store_result ========================================================================= #.
-
#store_where? ⇒ Boolean
# === store_where? ========================================================================= #.
-
#title? ⇒ Boolean
# === title? ========================================================================= #.
-
#use_only_master_lectures ⇒ Object
# === use_only_master_lectures ========================================================================= #.
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?, #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_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
#commandline?, #runmode?, #set_commandline_mode, #set_runmode, #set_www_mode, #www_mode?
#commandline_arguments?, #commandline_arguments_joined, #commandline_arguments_with_hyphens?, #commandline_arguments_without_leading_hyphens?, #first_argument?, #first_non_hyphen_argument?, #reset_the_commandline_arguments, #set_commandline_arguments, #set_first_argument
#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 = nil, run_already = true) ⇒ ExamsPerMonth
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
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 82
def initialize(
commandline_arguments = nil,
run_already = true
)
reset
case commandline_arguments
when :dont_run_yet,
:do_not_run_yet
run_already = false
else
set_input(commandline_arguments)
end
if block_given?
yielded = yield
case yielded
when /^-?-?yearly(-|_)?average(-|_)?grades$/
sanitize_dataset
do_show_yearly_average_grades
report
end
end
try_to_require_the_open_gem
run if run_already
end
|
Class Method Details
.curricula_assigned_exams_file? ⇒ Boolean
#
Studium::ExamsPerMonth.curricula_assigned_exams_file?
#
2409
2410
2411
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2409
def self.curricula_assigned_exams_file?
FILE_CURRICULA_ASSIGNED_EXAMS
end
|
.main_file? ⇒ Boolean
#
ExamsPerMonth.main_file?
#
2416
2417
2418
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2416
def self.
MENU_FILE
end
|
.open_main_files_in_the_editor ⇒ Object
#
Studium::ExamsPerMonth.open_main_files_in_the_editor
In the past file_theme_of_exams? was part of the Array defined below, but as of 26.03.2019 I decided that this file is no longer useful to me - it will eventually be phased out.
Invocation example to use this method from the commandline:
studium --open
#
951
952
953
954
955
956
957
958
959
960
961
962
963
964
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 951
def self.open_main_files_in_the_editor
array_open_these_files = [
main_file?,
curricula_assigned_exams_file?
]
unless Object.const_defined? :Open
begin
require 'open'
rescue LoadError; end
end
array_open_these_files.each {|file|
Open.in_editor(file)
}
end
|
.show_passed_bachelor_lectures ⇒ Object
#
Studium::ExamsPerMonth.show_passed_bachelor_lectures
#
2402
2403
2404
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2402
def self.show_passed_bachelor_lectures
Studium::ExamsPerMonth.new('--show_only_bachelor_lectures')
end
|
.show_passed_master_lectures ⇒ Object
#
Studium::ExamsPerMonth.show_passed_master_lectures
#
2395
2396
2397
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2395
def self.show_passed_master_lectures
Studium::ExamsPerMonth.new('--show_only_master_lectures')
end
|
Instance Method Details
#calculate_the_average_amount_per_passed_exam ⇒ Object
#
calculate_the_average_amount_per_passed_exam
#
1197
1198
1199
1200
1201
1202
1203
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1197
def calculate_the_average_amount_per_passed_exam
ects_per_exams_passed = (
@n_ects_points_in_total.to_f / @n_exams_in_total_passed.to_f
).round(2)
return ects_per_exams_passed
end
|
#colour_for_hours(i) ⇒ Object
Also known as:
colourize_hours
#
colour_for_hours
Mediumorchid is the colour for hours.
#
218
219
220
221
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 218
def colour_for_hours(i)
return mediumorchid(i) if use_colours? return i
end
|
#colourize_ects_points(i) ⇒ Object
Also known as:
colourize_ects, colour_ects
#
colourize_ects_points
No need to check inside this method for konsole support because we already do so before that.
#
249
250
251
252
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 249
def colourize_ects_points(i)
return dodgerblue(i) if use_colours?
return i
end
|
#colourize_month_year(i) ⇒ Object
#
colourize_month_year
This method will colourize strings such as ‘04.2017’.
The current colour used here is ‘goldenrod’.
#
238
239
240
241
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 238
def colourize_month_year(i)
return goldenrod(i) if use_colours?
return i
end
|
#colourize_n_exams(i, use_this_colour = :lightslategray) ⇒ Object
#
colourize_n_exams
Combound method to allow different colours.
#
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 260
def colourize_n_exams(
i,
use_this_colour = :lightslategray
)
if use_colours?
case use_this_colour when :lightslategray i = lightslategray(i)
when :oldlace
i = oldlace(i)
when :mediumseagreen
i = mediumseagreen(i)
when :papayawhip
i = papayawhip(i)
end
end
return i
end
|
#colourize_year(i) ⇒ Object
226
227
228
229
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 226
def colourize_year(i)
return swarn(i) if use_colours?
return i
end
|
#current_year? ⇒ Boolean
Also known as:
current_year
418
419
420
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 418
def current_year?
@current_year
end
|
#dataset? ⇒ Boolean
297
298
299
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 297
def dataset?
@dataset
end
|
#determine_n_ects_points_in_total ⇒ Object
#
determine_n_ects_points_in_total
The main Hash will look like this:
{"07.2018"=>[9.0, 14.0, ["+", "4", "1", "1"], "uniwien", 4]
The relevant ECTS entries are in the value part, at the second position, so [1].
#
1866
1867
1868
1869
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1866
def determine_n_ects_points_in_total
n_ects_points = @hash.values.map {|entry| entry[1] }.sum
set_n_ects_points_in_total(n_ects_points)
end
|
#determine_n_exams_in_total_were_passed ⇒ Object
#
determine_n_exams_in_total_were_passed
#
1874
1875
1876
1877
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1874
def determine_n_exams_in_total_were_passed
n_exams = @hash.values.map {|entry| entry.last }.sum
set_n_exams_in_total_passed(n_exams)
end
|
#determine_n_hours_were_passed_in_total ⇒ Object
#
determine_n_hours_were_passed_in_total
#
2358
2359
2360
2361
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2358
def determine_n_hours_were_passed_in_total
i = @hash.values.map {|entry| entry[0].to_f }.sum.to_f
@n_hours_passed_in_total = i
end
|
#do_show_ects_points ⇒ Object
496
497
498
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 496
def do_show_ects_points
@show_ects_points = true end
|
#do_show_only_grade_for(i = nil) ⇒ Object
#
do_show_only_grade_for
#
472
473
474
475
476
477
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 472
def do_show_only_grade_for(
i = nil
)
i = i.to_i if i
@show_only_grade_for = i
end
|
#do_show_only_this_year_here(i) ⇒ Object
#
do_show_only_this_year_here
Use this method if you only want to show a specific year, such as 2013 or 2017 and so forth.
#
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1267
def do_show_only_this_year_here(i)
@show_only_this_year = i _ = dataset?.select {|entry| the_year = entry.first.strip.split('.').last.to_s
is_it_included = false
is_it_included = true if @show_only_this_year == the_year
if @show_only_this_year.include? '-'
range = Range.new(*@show_only_this_year.split('-').map(&:to_i))
if range.include? the_year.to_i is_it_included = true
end
end
is_it_included
}
reset_main_hash sanitize_dataset(_, :leave_time_entry_alone)
end
|
#do_show_the_grades_statistics ⇒ Object
#
do_show_the_grades_statistics
Show all grade statistics.
Invocation example:
emo --grades
#
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1731
def do_show_the_grades_statistics
_ = dataset?
hash_containing_the_relevant_entries = {}
hash_containing_the_relevant_entries[1] = [0,0,0]
hash_containing_the_relevant_entries[2] = [0,0,0]
hash_containing_the_relevant_entries[3] = [0,0,0]
hash_containing_the_relevant_entries[4] = [0,0,0]
_.each {|line|
this_grade = line[3].to_i
if this_grade == 0
else
n_ects_points = line[1].to_f
n_hours = line[2].to_f
array = hash_containing_the_relevant_entries[this_grade]
array[0] += 1
array[1] += n_ects_points array[2] += n_hours hash_containing_the_relevant_entries[this_grade] = array
end
}
e
e lightgreen('The grades that were passed successfully, are as follows:')
e
average_grade = 0
average_grade_weighted_by_ects_points = 0
n_total_exams = hash_containing_the_relevant_entries.values.map {|array|
array.first
}.sum
hash_containing_the_relevant_entries.each_pair {|grade, array_dataset|
n_exams_passed = array_dataset.first
total_n_ects_points = array_dataset[1]
total_n_hours = array_dataset.last
n_percent = (n_exams_passed.to_i * 100 / n_total_exams).round(3).to_s
e "For the grade #{simp(grade)} #{crimson(n_exams_passed.to_s)} "\
"exams were passed successfully. (#{crimson(n_percent.to_s+'%')})"
e " n ECTS points: #{mediumorchid(total_n_ects_points.to_s.rjust(5))}"
e " n hours: #{mediumpurple(total_n_hours.to_s.rjust(5))}"
e
}
hash = hash_containing_the_relevant_entries
average_grade = (1 * hash[1][0]+
2 * hash[2][0]+
3 * hash[3][0]+
4 * hash[4][0])
total_n_ects_points = hash[1][1].to_f+
hash[2][1].to_f+
hash[3][1].to_f+
hash[4][1].to_f
average_grade_weighted_by_ects_points = (
1 * hash[1][1].to_f+
2 * hash[2][1].to_f+
3 * hash[3][1].to_f+
4 * hash[4][1].to_f
)
average_grade_weighted_by_ects_points =
average_grade_weighted_by_ects_points.to_f / total_n_ects_points.to_f average_grade = average_grade.to_f / (
hash[1][0]+
hash[2][0]+
hash[3][0]+
hash[4][0]
) average_grade = average_grade.round(2)
e 'This means that the average grade is: '+
slateblue(average_grade.to_s)
e 'And the average grade, weighted per single (1.0) ECTS point, is: '+
lightblue(average_grade_weighted_by_ects_points.round(2).to_s)
e
end
|
#do_show_yearly_average_grades ⇒ Object
#
do_show_yearly_average_grades
#
482
483
484
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 482
def do_show_yearly_average_grades
@show_yearly_average_grades = true
end
|
#draw_image_with_gruff ⇒ Object
#
draw_image_with_gruff
If we wish to draw an image with gruff then we use this method here.
#
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
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 338
def draw_image_with_gruff
begin
require 'gruff'
rescue LoadError; end
opne 'Startup of class '+sfancy(self.class.name)+'.'
@g = Gruff::Line.new(800)
@g.theme_keynote
@g.title_font_size = 25
@g.title = title?
@g.labels = {
1 => '25.10.2005',
11 => '08.04.2014',
20 => Time.now.strftime('%d.%m.%Y')
}
@g.data('Amount of exams per month',
[
274,340,851,1114,1168,1195,1230,
1245,1270,1315,1352,2524,2621],
'slateblue')
@g.minimum_value = 1
store_result
open_result_in_gimp
end
|
#
On Roebe, we will use the file in the home system.
#
397
398
399
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 397
def input?
@input
end
|
#is_this_sommersemester_or_wintersemester?(i) ⇒ Boolean
#
is_this_sommersemester_or_wintersemester?
This method will return SS or WS, as String.
The following months are Sommersemester (SS):
März, April, Mai, Juni, Juli, August, September (3-9)
The following months are Wintersemester (WS):
Oktober, November, Dezember, Jänner, Februar (10-2)
#
522
523
524
525
526
527
528
529
530
531
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 522
def is_this_sommersemester_or_wintersemester?(i)
return_this_string = '' case i.to_i when 3..9
return_this_string = 'SS'
when 10,11,12,1,2 return_this_string = 'WS'
end
return return_this_string
end
|
#last_year? ⇒ Boolean
Also known as:
last_year
411
412
413
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 411
def last_year?
@last_year
end
|
#main_file? ⇒ Boolean
897
898
899
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 897
def main_file?
self.class.main_file?
end
|
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 632
def (
i = input?
)
case i when /^-?-?OPEN$/i
open_the_main_files_in_the_editor
exit
when /^-?-?universities$/i,
/^-?-?unis$/i
show_ects_passed_per_university
exit
when /^-?-?boku$/,'BOKU'
show_only_exams_at_the_boku
when /^-?-?since (\d{1,4}\.?\d{0,2}\.?\d{0,4})$/, /^-?-?after (\d{1,4}\.?\d{0,2}\.?\d{0,4})$/ show_only_exams_past_this_date($1.to_s.dup)
when /^-?-?best(_|-)?month(_|-)?stats$/,
/^-?-?show(_|-)?best(_|-)?months?$/,
/^-?-?best(_|-)?months?$/
show_best_months
exit
when /^-?-?master$/
@hash.clear
use_only_master_lectures
when /^-?-?years$/,
/^-?-?table/,
/^-?-?short$/
show_the_years_in_a_short_table_overview
exit
when /^-?-?summary$/i
e; show_only_the_summary; e
exit
when /--half-split/
show_half_split_exams_per_year
exit
when /nl/,
/^-?-?show(_|-)?numbered(_|-)?exams$/, /^-?-?show(_|-)?passed(_|-)?lectures$/i
show_numbered_exams
exit
when /^-?-?only(_|-)?bachelor$/,
/^-?-?only(_|-)?bachelor(_|-)?lectures$/,
/^-?-?only(_|-)?bachelorcurricula$/,
/^-?-?show(_|-)?only(_|-)?bachelor(_|-)?lectures$/,
/^-?-?show(_|-)?bachelor(_|-)?lectures$/
show_only_bachelor_lectures
exit
when /^-?-?only(_|-)?master$/,
/^-?-?only(_|-)?master(_|-)?lectures$/,
/^-?-?only(_|-)?mastercurricula$/,
/^-?-?show(_|-)?only(_|-)?master(_|-)?lectures$/,
/^-?-?show(_|-)?master(_|-)?lectures$/
show_only_master_lectures
exit
when /-?-?disable-?colours/,
/-?-?nocolours/,
/-?-?dcolours/,
/-?-?nocol/
disable_colours
show_n_exams_passed_per_month
when /^-?-?yearly(_|-)?average(_|-)?grades$/,
/^-?-?yearly(_|-)?grades$/
do_show_yearly_average_grades
when /-?-?grades/
do_show_the_grades_statistics
exit
when /--grade=(\d+)/
do_show_only_grade_for($1.to_s.dup)
show_n_exams_passed_per_month
when /-?-?TU$/,
/-?-?tu$/,
/-?-?tuwien/
show_only_exams_at_the_tu
when /-?-?before (\d{1,4}\.?\d{0,2}\.?\d{0,4})/, /-?-?until (\d{1,4}\.?\d{0,2}\.?\d{0,4})/
show_only_exams_before_this_date($1.to_s.dup)
when /-?-?year=(\d+-?\d*)/,
/-?-?(\d{4})/,
/-?-?(\d{4}-?\d*)/ do_show_only_this_year_here($1.to_s.dup)
when /-?-?uniwien/,'--uniw',/-?-?wien/,'UNIWIEN','WIEN',
/-?-?vienna/
show_only_exams_at_the_uniwien
when /-?-?meduni$/,'--medu','--med','MEDUNI','MED','meduniwien',
'meduni'
show_only_exams_at_the_meduni
when /-?-?vetmed/,'--vet','VET','VETMED'
show_only_exams_at_the_vetmed_uni
when /-?-?only-?bachelor/ show_only_bachelor_exams
when /-?-?(individuell(_|-| )?bachelor)/
show_how_many_exams_we_have_passed_in_this_curriculum($1.to_s.dup)
exit
when /-?-?übungen/,
/--practical/
show_only_practical_courses_that_were_passed_already
when /-?-?semesters\??/
show_exam_ects_points_passed_per_semester
exit
when /-?-?reversed?-?nl/
show_numbered_exams(:reversed)
exit
when /-?-?(master-?lmbt)/
show_how_many_exams_we_have_passed_in_this_curriculum($1.to_s.dup)
exit
when /-?-?(lmbt)/,/-?-?(lbt)/
show_how_many_exams_we_have_passed_in_this_curriculum($1.to_s.dup)
exit
when /-?-?(agrarwissenschaften)/,/-?-?(AW)/
show_how_many_exams_we_have_passed_in_this_curriculum($1.to_s.dup)
exit
when '--show','--output'
output_the_csv_file
exit
when 'HELP',/^-?-?help$/
show_help
exit
when 'gruff','--gruff','image'
draw_image_with_gruff else if i and i.is_a?(String) and i.start_with?('/') and
(i.count('/') > 1) use_this_regexp = Regexp.new(i.delete('/'), Regexp::IGNORECASE)
Studium.try_to_report_exams_that_match_to_this_regexp(use_this_regexp)
exit
elsif i and ARRAY_REGISTERED_MONTHS.include?(i.delete('-').downcase)
show_all_exams_from_this_month(i.downcase)
exit
else end
end
end
|
904
905
906
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 904
def
self.class.
end
|
#n_exams_passed?(for_this_year = @current_year) ⇒ Boolean
425
426
427
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 425
def n_exams_passed?(for_this_year = @current_year)
@n_exams_passed
end
|
#obtain_dataset(use_this_file = main_file?
) ⇒ Object
#
obtain_dataset
The default value for the first argument derives from Studium.file_passed_exams_per_month, which is represented by the method called main_file?.
#
286
287
288
289
290
291
292
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 286
def obtain_dataset(
use_this_file = main_file?
)
set_dataset(
raw_dataset?(use_this_file)
)
end
|
#open_result_in_gimp ⇒ Object
#
open_result_in_gimp
This method is, quite obviously, for image-files.
#
971
972
973
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 971
def open_result_in_gimp
esystem "gimp #{store_where?} &"
end
|
#open_the_curricula_assigned_exams_file_in_the_editor ⇒ Object
#
open_the_curricula_assigned_exams_file_in_the_editor
#
933
934
935
936
937
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 933
def open_the_file_lecture_information_in_the_editor(
i = file_lecture_information?
)
Open.in_editor(i)
end
|
#open_the_main_file_in_the_editor ⇒ Object
#
open_the_main_file_in_the_editor
#
919
920
921
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 919
def open_the_main_file_in_the_editor
Open.in_editor(main_file?)
end
|
#open_the_main_files_in_the_editor ⇒ Object
#
open_the_main_files_in_the_editor (open tag)
This method bundles together some other open-related methods. It should ideally come last in this file here, so that it can be updated at a later time if my use case has changed.
#
2377
2378
2379
2380
2381
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2377
def open_the_main_files_in_the_editor
open_the_main_file_in_the_editor
open_the_file_lecture_information_in_the_editor
end
|
926
927
928
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 926
def
Open.in_editor()
end
|
#output_colourized_year_and_colourized_hours(year) ⇒ Object
#
output_colourized_year_and_colourized_hours
#
536
537
538
539
540
541
542
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 536
def output_colourized_year_and_colourized_hours(year)
unless @compare_these_numbers and !@compare_these_numbers.include?(year)
e colourize_year(year.to_s) e " "\
"#{colourize_hours('n hours')}"
end
end
|
#output_the_csv_file ⇒ Object
#
output_the_csv_file
We will either use Cat[], if it is available, or just File.read().
#
505
506
507
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 505
def output_the_csv_file
e File.read(csv_file?)
end
|
#raw_dataset?(use_this_file = main_file?
) ⇒ Boolean
#
raw_dataset?
This method will return an Array. The Array came from the file ‘passed_exams_per_month.csv’.
#
325
326
327
328
329
330
331
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 325
def raw_dataset?(
use_this_file = main_file?
)
readlines_from_this_input_file(use_this_file).reject! {|entry|
entry.start_with? '#'
}.map(&:chomp).reject(&:empty?)
end
|
#report_how_many_ects_points_have_been_gathered_so_far(n_ljust = N_LJUST) ⇒ Object
#
report_how_many_ects_points_have_been_gathered_so_far
#
186
187
188
189
190
191
192
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 186
def report_how_many_ects_points_have_been_gathered_so_far(
n_ljust = N_LJUST
)
e "#{rev}In total, #{slategray('n ECTS points')} #{rev}have been "\
"gathered so far: ".ljust(n_ljust+8)+
"#{sfancy(@n_ects_points_in_total.to_s)}"
end
|
#report_how_many_exams_were_passed_in_total(i = @n_exams_in_total_passed, ljust_n_times = N_LJUST, n_rjust = 4) ⇒ Object
#
report_how_many_exams_were_passed_in_total
#
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 116
def report_how_many_exams_were_passed_in_total(
i = @n_exams_in_total_passed,
ljust_n_times = N_LJUST,
n_rjust = 4
)
if ljust_n_times == :default
ljust_n_times = N_LJUST
end
e (
"#{rev}In total, #{slategray('n exams')} #{rev}have been passed:"
).ljust(ljust_n_times+7)+
sfancy(i.to_s.rjust(n_rjust))
end
|
#report_how_many_hours_were_passed_in_total(i = @n_hours_passed_in_total, n_ljust = N_LJUST, n_rjust = 6) ⇒ Object
#
report_how_many_hours_were_passed_in_total
This method will report how many hours were passed in total.
#
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 135
def report_how_many_hours_were_passed_in_total(
i = @n_hours_passed_in_total,
n_ljust = N_LJUST,
n_rjust = 6
)
if n_ljust == :default
n_ljust = N_LJUST
end
left_side_string = "#{rev}In total, #{slategray('n hours')} "\
"#{rev}were completed: ".ljust(n_ljust+7)
i = i.round(1) if i.is_a? Float
e left_side_string+
sfancy(i.to_s.rjust(n_rjust))
end
|
#report_how_many_of_these_ects_points_required_mandatory_presence(n_ects_points_in_mandatory_presence_courses = Studium.n_ects_points_in_mandatory_presence_courses, n_ljust = N_LJUST) ⇒ Object
#
report_how_many_of_these_ects_points_required_mandatory_presence
Report how many ECTS points have been passed that required a mandatory presence (aka “prüfungsimmanent” in german).
#
#report_month_year_hours_ects_n_exams_passed_in_this_month(month, year, n_hours, n_ECTS, n_exams_passed_in_this_month) ⇒ Object
#
report_month_year_hours_ects_n_exams_passed_in_this_month
#
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 547
def report_month_year_hours_ects_n_exams_passed_in_this_month(
month, year, n_hours, n_ECTS, n_exams_passed_in_this_month
)
result = (
colourize_month_year(month.to_s.rjust(2,'0')+'.'+year.to_s)+
':'+(' ' * 13)+ colourize_hours(n_hours.to_s.rjust(6))+' '
).dup
if show_ects_points?
result << colourize_ects('('+n_ECTS.to_f.to_s.rjust(4)+' ECTS points)')
end
result << colourize_n_exams(' (n exams passed that month: '+
n_exams_passed_in_this_month.to_s.rjust(2)+')')
e result
end
|
#report_the_average_amount_of_ects_per_passed_exam(ects_per_exams_passed = calculate_the_average_amount_per_passed_exam, ljust_n_times = N_LJUST, rjust_n_times = 12) ⇒ Object
#
report_the_average_amount_of_ects_per_passed_exam
#
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2313
def report_the_average_amount_of_ects_per_passed_exam(
ects_per_exams_passed = calculate_the_average_amount_per_passed_exam,
ljust_n_times = N_LJUST,
rjust_n_times = 12
)
case ljust_n_times
when :default
ljust_n_times = N_LJUST
end
left_padded_side = "#{rev}On average, the "\
"#{slategray('ECTS per passed exam')} "\
"#{rev}are: ".ljust(ljust_n_times+7)
e left_padded_side+
sfancy(
(ects_per_exams_passed.to_s+' ECTS').rjust(rjust_n_times)
)
end
|
#report_the_average_grade(n_ljust = N_LJUST, n_rjust = 4) ⇒ Object
#
report_the_average_grade
This method will report the average grade.
#
199
200
201
202
203
204
205
206
207
208
209
210
211
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 199
def report_the_average_grade(
n_ljust = N_LJUST,
n_rjust = 4
)
if n_ljust == :default
n_ljust = N_LJUST
end
e "#{rev}The #{slategray('average grade')} #{rev}for these "\
"exams is: ".ljust(n_ljust+10)+
sfancy(
average_grade.to_s.rjust(n_rjust)
)
end
|
#report_total_amount_of_ects_points(total_ects_points, bachelor_or_master = :bachelor, ljust_to_use = 41) ⇒ Object
#
report_total_amount_of_ects_points
#
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1636
def report_total_amount_of_ects_points(
total_ects_points,
bachelor_or_master = :bachelor,
ljust_to_use = 41 )
bachelor_or_master = bachelor_or_master.to_s.capitalize e
e 'Total ECTS points from '+bachelor_or_master+' lectures: '.
ljust(ljust_to_use)+
slateblue(total_ects_points.to_s+' ECTS')
e
end
|
#reset ⇒ Object
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 978
def reset
super() do_show_ects_points
infer_the_namespace
@shall_we_report = true @show_only_grade_for = nil @total_grade = 0
@n_exams_in_total_passed = 0
@n_ects_points_belonging_to_mandatory_presence_courses = 0
@total_ects_points = 0 @n_ects_points = 0 @n_ects_points_in_total = 0 @n_hours_passed_in_total = 0 @compare_these_numbers = nil
@show_only_this_year = nil
enable_colours
@show_average_ects_passed_per_exam = true
@show_yearly_average_grades = false
@show_n_best_months = SHOW_N_BEST_MONTHS
@dataset_from_the_file_lecture_information =
return_dataset_from_the_file_lecture_information
set_current_year(Time.now.strftime('%Y').to_i)
set_last_year
reset_main_hash
obtain_dataset end
|
#reset_ects_points ⇒ Object
Also known as:
reset_ects
1071
1072
1073
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1071
def reset_ects_points
@n_ects_points = 0
end
|
#reset_main_hash ⇒ Object
1056
1057
1058
1059
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1056
def reset_main_hash
@hash = {}
@hash.default = []
end
|
#reset_n_hours ⇒ Object
Also known as:
reset_hours
1064
1065
1066
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1064
def reset_n_hours
@n_hours_passed_in_total = 0
end
|
#run ⇒ Object
2386
2387
2388
2389
2390
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2386
def run
sanitize_dataset
report if @shall_we_report
end
|
#sanitize_dataset(i = dataset?,
, modify_time_entry = true) ⇒ Object
#
sanitize_dataset
Purpose of this method is to give us a sorted hash with the specific entries. In order for this to work, simply pass in your dataset into this method. By default, we will use the dataset? object, which is essentially just the @dataset instance variable.
The initial dataset should have 6 entries, thus 5 occurrences of ‘|’.
Example for such a dataset/line:
"06.07.2018 | 1.0 | 1.0 | 1 | UniWien | M | VO | 270073 | 2018S | Nukleinsäureanalytik-Genomics"
#
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1090
def sanitize_dataset(
i = dataset?,
modify_time_entry = true
)
@n_ects_points_belonging_to_mandatory_presence_courses = 0 case modify_time_entry
when :leave_time_entry_alone
modify_time_entry = false
end
@dataset = i.map {|entry|
if entry.is_a? Array
splitted = entry
else
encoding_to_use = ::Studium.encoding?
unless entry.encoding.to_s.include? encoding_to_use
entry = entry.force_encoding(encoding_to_use)
end
splitted = entry.split(' | ') end
if splitted.size <= 2 splitted = nil
else
if modify_time_entry
formatted_time = splitted[0].split('.')[1..-1].join('.') splitted[0] = formatted_time
end
if @compare_these_numbers and formatted_time
the_year = formatted_time.split('.').last.to_i
unless @compare_these_numbers.include? the_year
splitted = nil
end
end
end
splitted
}
@dataset.compact! @n_exams_passed = 0
@dataset.each {|entry|
entry.map!(&:strip)
month_and_year = entry[0] n_hours = entry[1].to_f n_ects_points = entry[2].to_f grade = entry[3] university = entry[4].strip.downcase _curriculum_type = entry[5].strip lecture_type = entry[6].strip if is_a_prüfungsimmanent_course?(lecture_type)
@n_ects_points_belonging_to_mandatory_presence_courses += n_ects_points
end
@n_exams_passed += 1
if @hash.has_key? month_and_year
new_n_hours = @hash[month_and_year][0]+n_hours
new_n_ects_points = @hash[month_and_year][1]+n_ects_points
array_grade = @hash[month_and_year][2] << grade
@hash[month_and_year] = [
new_n_hours, new_n_ects_points, array_grade, university, @n_exams_passed
]
else @n_exams_passed = 0 @n_exams_passed += 1 @hash[month_and_year] = [
n_hours, n_ects_points, [grade], university, @n_exams_passed
]
end
}
end
|
#set_current_year(i = Time.now.strftime('%Y').to_i) ⇒ Object
#
set_current_year
This must be an Integer.
#
434
435
436
437
438
439
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 434
def set_current_year(
i = Time.now.strftime('%Y').to_i
)
i = i.to_i
@current_year = i
end
|
#set_dataset(i) ⇒ Object
315
316
317
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 315
def set_dataset(i)
@dataset = i
end
|
#
The input can be an Array such as [“2013”, “2015”], in which case we will only output certain numbers matching these criteria.
#
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 447
def set_input(i = nil)
if i.is_a? Array
unless i.empty? only_numbers = i.all? {|number|
number.to_s =~ /^\d+$/ }
if only_numbers
@compare_these_numbers = i.map(&:to_i)
end
end
i = i.join(' ').strip
end
@input = i
end
|
#set_last_year(i = current_year?)
) ⇒ Object
404
405
406
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 404
def set_last_year(i = current_year?)
@last_year = i
end
|
#set_n_ects_points_in_total(i) ⇒ Object
#
set_n_ects_points_in_total
#
1852
1853
1854
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1852
def set_n_ects_points_in_total(i)
@n_ects_points_in_total = i.to_f
end
|
#set_n_exams_in_total_passed(i) ⇒ Object
#
set_n_exams_in_total_passed
#
1845
1846
1847
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1845
def set_n_exams_in_total_passed(i)
@n_exams_in_total_passed = i.to_f
end
|
#set_store_where(i) ⇒ Object
374
375
376
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 374
def set_store_where(i)
@store_where = i
end
|
#show_all_exams_from_this_month(i = 'januar') ⇒ Object
#
show_all_exams_from_this_month
Use this method to show all exams from a given month only.
We also support english names for the months, since as of April 2017.
Usage example:
emo --januar
#
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1383
def show_all_exams_from_this_month(i = 'januar')
i.delete!('-') if i.include? '-'
i.downcase!
case i when 'januar','january'
i = '01'
when 'februar','february',/feb/
i = '02'
when 'märz','march'
i = '03'
when 'april'
i = '04'
when 'mai','may'
i = '05'
when 'juni','june'
i = '06'
when 'juli','july'
i = '07'
when 'august'
i = '08'
when 'september'
i = '09'
when 'oktober','october'
i = '10'
when 'november'
i = '11'
when 'dezember','december'
i = '12'
end
_ = dataset?.select {|inner_array|
month_and_year = inner_array.first
splitted = month_and_year.split('.')
month = splitted.first
month == i
}
reset_main_hash
sanitize_dataset(_, :leave_time_entry_alone)
end
|
#show_best_months(do_show_n_months = @show_n_best_months) ⇒ Object
#
show_best_months
This method will show the best months, sorted. Best comes first.
Invocation example:
emo --show-best-months
#
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1938
def show_best_months(
do_show_n_months = @show_n_best_months
)
opne 'Showing the '+slateblue(do_show_n_months.to_s)+' best '\
'months next, sorted by n ECTS points passed:'
e
hash_month_statistics = {}
_ = @hash.sort_by {|key, inner_array|
n_ECTS_points = inner_array[1].to_f
n_ECTS_points
}.reverse
array_to_display = []
_.each {|month, inner_array|
array_to_display << [ month, inner_array[1].to_f ]
}
array_to_display = array_to_display[0..(do_show_n_months - 1)]
exam_number_n = 0 array_to_display.each {|month, n_ECTS_points_passed|
exam_number_n += 1
left_pad = ((exam_number_n.to_s+')').rjust(5)).ljust(6)
rounded_n_ECTS_points_passed = n_ECTS_points_passed.to_s.to_f.round(1)
e yellow(left_pad)+'In the month '+
sfancy(month)+', '+
violet(rounded_n_ECTS_points_passed.to_s.rjust(4))+
' ECTS points were completed.'
this_month = month.split('.').first.to_i this_month = Studium::MONTH_NUMBER_TO_MONTH_NAME[this_month]
hash = {
:n_ects => n_ECTS_points_passed,
:n_times_mentioned => 1
}
if hash_month_statistics.has_key? this_month
hash_month_statistics[this_month][:n_ects] += n_ECTS_points_passed
hash_month_statistics[this_month][:n_times_mentioned] += 1
else
hash_month_statistics[this_month] = hash
end
}
e
colourized_n_best_months = orange(do_show_n_months)
opne "The best #{colourized_n_best_months} (top) months "\
"seem to be the following ones:"
e
_ = hash_month_statistics
_ = _.sort_by {|name_of_the_month, hash_containing_n_ects_and_n_times_mentioned|
n_ects = hash_containing_n_ects_and_n_times_mentioned[:n_ects]
n_ects
}.reverse
counter = 0
_.each {|name_of_the_month, hash_containing_n_ects_and_n_times_mentioned|
next if counter > 7 n_ects = hash_containing_n_ects_and_n_times_mentioned[:n_ects]
n_times_mentioned = hash_containing_n_ects_and_n_times_mentioned[:n_times_mentioned]
counter += 1
e ' '+
sfancy((name_of_the_month+':').ljust(12))+
orange(n_times_mentioned.to_s.rjust(2))+ olivedrab(' (ECTS in total: ')+
colourize_ects_points(n_ects.to_s.rjust(5))+
olivedrab('; average ECTS in that month: ')+
colourize_ects_points(
(n_ects.to_f / n_times_mentioned.to_i).round(1).to_s.rjust(4)
)+
olivedrab(')')
}
e
end
|
#show_colourized_line(n_times = 34) ⇒ Object
1924
1925
1926
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1924
def show_colourized_line(n_times = 34)
e simp('-' * n_times)
end
|
#show_ects_passed_per_university ⇒ Object
#
show_ects_passed_per_university
#
2366
2367
2368
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2366
def show_ects_passed_per_university
Studium::EctsPerUniversity.new { :sort_by_highest_first }
end
|
#show_ects_points? ⇒ Boolean
489
490
491
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 489
def show_ects_points?
@show_ects_points
end
|
#show_exam_ects_points_passed_per_semester ⇒ Object
#
show_exam_ects_points_passed_per_semester
#
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1453
def show_exam_ects_points_passed_per_semester
hash = {}
_ = dataset?
opne 'We will next show how many exams were passed in a given semester.'
_.each {|inner_array|
_n_wochenstunden = inner_array[1]
n_ects_points = inner_array[2]
_name_of_the_lecture = inner_array.last
month_year = inner_array.first
year = month_year.dup
if month_year.include? '.'
splitted = month_year.split('.')
month_year = splitted.first
year = splitted.last.to_i
end
sommersemester_or_wintersemester = is_this_sommersemester_or_wintersemester?(
month_year
)
month_as_number = month_year.split('.').first.to_i
if (sommersemester_or_wintersemester == 'WS') and
[1,2].include?(month_as_number)
year -= 1
end
hash_key_to_use = sommersemester_or_wintersemester+' '+year.to_s
if hash.has_key? hash_key_to_use hash[hash_key_to_use] = hash[hash_key_to_use]+n_ects_points.to_f
else
hash[hash_key_to_use] = n_ects_points.to_f
end
}
e 'We have determined these ECTS points per semester:'; e
hash.each_pair {|semester_and_year, n_ects_points|
e ' '+simp(semester_and_year.ljust(8))+' '+
sfancy(((n_ects_points.to_s.rjust(4))+' ECTS').rjust(8))
}
e; e 'Total ECTS points: '+simp(hash.values.sum.to_s)
end
|
#show_half_split_exams_per_year ⇒ Object
#
show_half_split_exams_per_year
This method can be used to show how many exams were passed, per year, in each half of that year.
Invocation example:
emo --half-split
#
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1216
def show_half_split_exams_per_year
array_early_months = %w( 1 2 3 4 5 6 ).map(&:to_i)
array_late_months = %w( 7 8 9 10 11 12 ).map(&:to_i)
hash = {}
raw_dataset?.each {|this_line|
next unless this_line.include? '|'
splitted = this_line.strip.split('|').map(&:strip)
first_element = splitted.first n_ects = splitted[2].to_f
year = first_element.split('.').last
hash[year] = {
:early_months => 0,
:late_months => 0
} unless hash.has_key? year
month = first_element.split('.')[1].to_i
if array_early_months.include? month
hash[year][:early_months] += n_ects
elsif array_late_months.include? month
hash[year][:late_months] += n_ects
end
}
hash.each_pair {|year, value|
n_ljust = 28
first_half_ects_points = value[:early_months].to_f
second_half_ects_points = value[:late_months].to_f
unless ( (first_half_ects_points == 0) and (second_half_ects_points == 0) )
e slateblue(year+':')
e
if first_half_ects_points > 0
e (' Start of the year '+year+': ').ljust(n_ljust)+
orange(first_half_ects_points.to_s.rjust(4)+' ECTS points')
end
if second_half_ects_points > 0
e (' End of the year '+year+':').ljust(n_ljust)+
orange(second_half_ects_points.to_s.rjust(4)+' ECTS points')
end
e
end
}
end
|
#show_help ⇒ Object
#
show_help (help tag)
To invoke this method, do:
emo --help
#
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 574
def show_help
left_indent = (' ' * 26)+'# ' opne 'Currently these options are supported:'
e
e ' input numbers only to compare years, such as: '
e
e " #{sfancy('emo 2013 2015')}"
e
e ' --disable-colours # Do not use colours'
e ' --gruff # draw an image with gruff'
e ' --nl # show a numbered listing of the '\
'passed exams, starting from 1 (== most recent exam)'
e ' --only-bachelor # show only Bachelor exams'
e ' --open # open the .csv file in the editor'
e ' --show # show / output the .csv file on '\
'the terminal'
e ' --semesters # show the amount of ECTS points passed '\
'per (full) semester'
e " --übungen # show only practical courses that were "\
"passed (#{sfancy('--practical')} is an alias to this)"
e ' --grades # show a distribution of my grades (1,2,3,4)'
e ' --grade={1,2,3,4,5] # show only grades that qualify for this'
e ' --yearly-average-grades # show the yearly average grades'
e ' --year=(dddd) # show only this specific year, such '\
'as "year=2016"; year=1996-2013 is also'
e left_indent+'supported; you can also omit --"year" such as '\
'in: emo --2005'
e ' --master # show only entries registered in '\
'a master curriculum'
e ' --boku # show only exams at this given '\
'university; also works with TU, UniWien etc'
e ' --summary # show only the summary over the '\
'exam-dataset'
e ' --only-master-lectures # show only lectures that are part '\
'of a (at the least one) master-curriculum.'
e ' --show-best-months # This will show the best 10-'+
SHOW_N_BEST_MONTHS.to_s+' months '\
'or so, in regards to'
e left_indent+'n ECTS points accumulated'
e ' --years # show only the amount of ECTS '\
'passed per year'
e ' --month # show the month, such as "emo --february"'
e ' "since 18.01.2013" # show only exams past this '\
'specified date (in the mandatory format dd.mm.yyyy)'
e ' "before 18.01.2013" # show only exams before this '\
'specified date (in the mandatory format dd.mm.yyyy)'
e
e 'The next options show how many exams were passed already '\
'in a given curriculum:'
e
e ' emo --agrarwissenschaften'
e ' emo --lmbt'
e
end
|
#show_how_many_exams_we_have_passed_in_this_curriculum(i) ⇒ Object
#
show_how_many_exams_we_have_passed_in_this_curriculum
This method will show how many exams we have already passed for a given curriculum xyz.
To invoke this, do:
emo --agrarwissenschaften
#
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1831
def show_how_many_exams_we_have_passed_in_this_curriculum(i)
require 'studium/utility_scripts/show_lectures_on_the_commandline/show_lectures_on_the_commandline.rb'
i = i.to_s.delete('_')
_ = ::Studium::ShowLecturesOnTheCommandline.new(
i, :do_not_run_yet
)
_.do_not_report_anything
_.iterate_over_the_lectures
_.report_how_many_exams_have_been_passed_already
end
|
#show_n_exams_passed_per_month(i = @hash) ⇒ Object
Also known as:
report_main_hash, report
#
show_n_exams_passed_per_month (report tag)
This is the main report-method for this class.
Make sure that the input to this method is correct.
#
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2123
def show_n_exams_passed_per_month(
i = @hash
)
month = 0
year = 0
n_hours = 0
n_ECTS = 0
grade = 0
n_exams_passed_in_this_month = 0
total_n_ects_passed_in_this_year = 0
total_n_hours_passed_in_this_year = 0
total_n_exams_passed_in_this_year = 0
total_grade_count_in_this_year = 0
exclude_n_exams_from_the_grade_list = 0
last_year = LAST_YEAR this_year = Time.now.year.to_i
if @show_only_grade_for
opne "We will only show grades that are equal to "\
"#{simp(@show_only_grade_for.to_s)}."
end
e
opne 'We will show how many hours / ECTS we passed per '\
'given month and then year.'
e
spacer
if @show_only_this_year and
@show_only_this_year.include?('-') and
@show_only_this_year.split('-').last.to_i < last_year
elsif @show_only_this_year and
(@show_only_this_year != last_year) and
(this_year != last_year)
else output_colourized_year_and_colourized_hours(last_year)
end
i.each {|month_year, n_hours_n_ECTS_grade_university_n_exams_passed|
month, year = month_year.split('.').map(&:to_i)
n_hours, n_ECTS, grade, _university, n_exams_passed_in_this_month =
n_hours_n_ECTS_grade_university_n_exams_passed
if @show_only_grade_for
next unless grade == @show_only_grade_for
end
if year != last_year
show_total_summary_for_year_hours_ects_n_exams(
last_year, total_n_hours_passed_in_this_year,
total_n_ects_passed_in_this_year,
total_n_exams_passed_in_this_year,
total_grade_count_in_this_year
) {{ exclude_n_exams_from_the_grade_list: exclude_n_exams_from_the_grade_list }}
total_n_ects_passed_in_this_year = 0
total_n_hours_passed_in_this_year = 0
total_n_exams_passed_in_this_year = 0
total_grade_count_in_this_year = 0
exclude_n_exams_from_the_grade_list = 0
spacer unless @show_only_this_year and (@show_only_this_year != last_year)
output_colourized_year_and_colourized_hours(year)
last_year = year
end
total_n_hours_passed_in_this_year += n_hours
@n_hours_passed_in_total += n_hours
total_n_ects_passed_in_this_year += n_ECTS
@n_ects_points_in_total += n_ECTS
total_n_exams_passed_in_this_year += n_exams_passed_in_this_month
@n_exams_in_total_passed += n_exams_passed_in_this_month.to_i
if grade.include? '+'
exclude_n_exams_from_the_grade_list += grade.count('+')
grade.reject! {|entry| entry == '+' }
end
add_this_number = grade.map(&:to_i).sum
total_grade_count_in_this_year += add_this_number
report_month_year_hours_ects_n_exams_passed_in_this_month(
month, year, n_hours, n_ECTS, n_exams_passed_in_this_month
)
}
show_total_summary_for_year_hours_ects_n_exams(
last_year,
total_n_hours_passed_in_this_year,
total_n_ects_passed_in_this_year,
total_n_exams_passed_in_this_year,
total_grade_count_in_this_year
) {{ exclude_n_exams_from_the_grade_list: exclude_n_exams_from_the_grade_list }}
e
ljust_it_n_times = :default
report_how_many_exams_were_passed_in_total(@n_exams_in_total_passed, ljust_it_n_times)
if show_ects_points? ects_per_exams_passed = (
@n_ects_points_in_total.to_f / @n_exams_in_total_passed.to_f
).round(2)
report_how_many_hours_were_passed_in_total(
@n_hours_passed_in_total, ljust_it_n_times
)
report_how_many_ects_points_have_been_gathered_so_far
report_how_many_of_these_ects_points_required_mandatory_presence(
@n_ects_points_belonging_to_mandatory_presence_courses
)
if @show_average_ects_passed_per_exam
report_the_average_amount_of_ects_per_passed_exam(
ects_per_exams_passed, ljust_it_n_times
)
end
report_the_average_grade(ljust_it_n_times)
end
end
|
#show_number_then_name_of_the_lecture_then_n_ECTS_points_then_leistung_erbracht_then_which_university(index, name_of_the_lecture, n_ects, leistung_erbracht_am, which_university) ⇒ Object
#
show_number_then_name_of_the_lecture_then_n_ECTS_points_then_leistung_erbracht_then_which_university
This long compound method is only used from within the following two methods:
show_only_bachelor_lectures
show_only_master_lectures
#
1659
1660
1661
1662
1663
1664
1665
1666
1667
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1659
def show_number_then_name_of_the_lecture_then_n_ECTS_points_then_leistung_erbracht_then_which_university(
index, name_of_the_lecture, n_ects, leistung_erbracht_am, which_university
)
e lightgreen((index.to_s+')').rjust(6))+' '+
orange(name_of_the_lecture.ljust(74))+' '+
slateblue(n_ects.to_s+' ECTS')+crimson(
' '+leistung_erbracht_am.to_s
)+' '+which_university
end
|
#show_numbered_exams(normal_or_reversed = :normal) ⇒ Object
#
show_numbered_exams
This method will output the passed exams.
To output this method, try this:
emo --show-numbered-exams
emo --reversed-nl
#
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1323
def show_numbered_exams(normal_or_reversed = :normal)
dataset = File.readlines(csv_file?).reject {|entry|
entry.start_with? '#'
}.reject {|entry|
entry.to_s.strip.empty?
}
size_of_the_dataset = dataset.size
e; dataset.each_with_index {|line, index|
index += 1
if normal_or_reversed == :reversed
index = (size_of_the_dataset - index)+1
end
e ' '+orange(index.to_s.rjust(4))+') '+simp(line.chomp)
}; e
end
|
#show_only_bachelor_exams ⇒ Object
#
show_only_bachelor_exams
Use this method to show only exams relevant for the Bachelor.
Invocation example:
emo --show-only-bachelor
#
1552
1553
1554
1555
1556
1557
1558
1559
1560
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1552
def show_only_bachelor_exams
opne 'Showing only Bachelor exams.'
_ = dataset?.select {|entry|
curriculum_type = entry[5].strip curriculum_type.include? 'B'
}
reset_main_hash
sanitize_dataset(_, :leave_time_entry_alone)
end
|
#show_only_bachelor_lectures ⇒ Object
#
show_only_bachelor_lectures
As the variant for master lectures, just for bachelor lectures.
To invoke it, do:
emo --show-only-bachelor-lectures
#
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1612
def show_only_bachelor_lectures
_ = @dataset.select {|array|
bachelor_or_master_curriculum = array[5].strip
bachelor_or_master_curriculum.include? 'B'
}
total_ects_points = 0
e
_.each_with_index {|lecture_data, index|
index += 1
n_ects = lecture_data[2]
total_ects_points += n_ects.to_f
name_of_the_lecture = lecture_data.last
leistung_erbracht_am = lecture_data.first
which_university = mediumturquoise(lecture_data[4])
show_number_then_name_of_the_lecture_then_n_ECTS_points_then_leistung_erbracht_then_which_university(
index, name_of_the_lecture, n_ects, leistung_erbracht_am, which_university
)
}
report_total_amount_of_ects_points(total_ects_points, :bachelor)
end
|
#show_only_exams_at_the_boku ⇒ Object
#
show_only_exams_at_the_boku
Show only exams at the BOKU.
#
2106
2107
2108
2109
2110
2111
2112
2113
2114
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2106
def show_only_exams_at_the_boku
opne 'Showing all exams passed at the BOKU.'
_ = dataset?.select {|entry|
name_of_university = entry[4]
(name_of_university.strip.downcase == 'boku')
}
reset_main_hash
sanitize_dataset(_, :leave_time_entry_alone)
end
|
#show_only_exams_at_the_meduni ⇒ Object
#
show_only_exams_at_the_meduni
Invoke this method like so:
emo --meduni
#
1363
1364
1365
1366
1367
1368
1369
1370
1371
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1363
def show_only_exams_at_the_meduni
opne 'Showing all exams passed at the MedUni Wien.'
_ = dataset?.select {|entry|
name_of_university = entry[4]
(name_of_university.strip.downcase == 'meduni')
}
reset_main_hash
sanitize_dataset(_, :leave_time_entry_alone)
end
|
#show_only_exams_at_the_tu ⇒ Object
#
show_only_exams_at_the_tu
Show only exams at the TU.
#
1713
1714
1715
1716
1717
1718
1719
1720
1721
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1713
def show_only_exams_at_the_tu
opne 'Showing all exams passed at the TU.'
_ = dataset?.select {|entry|
name_of_university = entry[4]
(name_of_university.strip.downcase.start_with? 'tu')
}
reset_main_hash
sanitize_dataset(_, :leave_time_entry_alone)
end
|
#show_only_exams_at_the_uniwien ⇒ Object
#
show_only_exams_at_the_uniwien
Invoke this method like so:
emo --uniwien
#
1347
1348
1349
1350
1351
1352
1353
1354
1355
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1347
def show_only_exams_at_the_uniwien
opne 'Showing all exams passed at the UniWien.'
_ = dataset?.select {|entry|
name_of_university = entry[4]
(name_of_university.strip.downcase == 'uniwien')
}
reset_main_hash
sanitize_dataset(_, :leave_time_entry_alone)
end
|
#show_only_exams_at_the_vetmed_uni ⇒ Object
#
show_only_exams_at_the_vetmed_uni
Invoke this method like so:
emo --vetmed
#
1304
1305
1306
1307
1308
1309
1310
1311
1312
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1304
def show_only_exams_at_the_vetmed_uni
opne 'Showing all exams passed at the Vetmed Uni.'
_ = dataset?.select {|entry|
name_of_university = entry[4]
(name_of_university.strip.downcase == 'vetmed')
}
reset_main_hash
sanitize_dataset(_, :leave_time_entry_alone)
end
|
#show_only_exams_before_this_date(this_date) ⇒ Object
#
show_only_exams_before_this_date
The argument to this method should be the starting time, the day at which you wish to keep track of exams made BEFORE this date.
To invoke this method, do:
emo "before 10.01.2011"
#
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1521
def show_only_exams_before_this_date(this_date)
unless this_date.include? '.'
this_date.prepend('01.01.') end
opne 'Showing only passed exams before the date '+simp(this_date.to_s)+'.'
this_date = Time.parse(this_date) if this_date.is_a? String
a = this_date _ = dataset?
new_array_with_matches = []
_.each {|entry|
date = Time.parse('01.'+entry.first.strip) b = date
if a > b
new_array_with_matches << entry
end
}
reset_main_hash
sanitize_dataset(new_array_with_matches, :leave_time_entry_alone)
end
|
#show_only_exams_past_this_date(this_date) ⇒ Object
#
show_only_exams_past_this_date
The argument to this method should be the starting time, the day at which you wish to keep track of exams made afterwards.
To invoke this method, do:
emo "since 10.02.2014"
#
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1678
def show_only_exams_past_this_date(this_date)
unless this_date.include? '.'
this_date.prepend('01.01.') end
opne 'Showing only passed exams past the date '+simp(this_date.to_s)+'.'
this_date = Time.parse(this_date) if this_date.is_a? String
a = this_date _ = dataset?
new_array_with_matches = []
_.each {|entry|
first = '01.'+entry.first.strip
date = Time.parse(first) b = date
if a < b
new_array_with_matches << entry end
}
reset_main_hash sanitize_dataset(new_array_with_matches, :leave_time_entry_alone)
end
|
#show_only_master_lectures ⇒ Object
#
show_only_master_lectures
This method is tasked to show only master lectures. For this purpose, we define a lecture to be a “master” lecture if it is part of at the least one master-curriculum. With this definition, a lecture that is registered in both a bachelor and a master curriculum, will satisfy this defintion and thus be listed.
We will take the file passed_exams_per_month.csv for this.
That file will have entries such as:
28.11.2016 | 3.0 | 6.0 | 1 | UniWien | M | 330011 | Zell- und Molekularbiologie
So we can pick field number 6. If that field has an upcased ‘M’ then it qualifies.
To invoke this method from the commandline, do:
emo --show-only-master-lectures
#
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1583
def show_only_master_lectures
_ = @dataset.select {|array|
bachelor_or_master_curriculum = array[5].strip
bachelor_or_master_curriculum.include? 'M'
}
total_ects_points = 0
e
_.each_with_index {|lecture_data, index|
index += 1
n_ects = lecture_data[2]
total_ects_points += n_ects.to_f
name_of_the_lecture = lecture_data.last
leistung_erbracht_am = lecture_data.first
which_university = mediumturquoise(lecture_data[4])
show_number_then_name_of_the_lecture_then_n_ECTS_points_then_leistung_erbracht_then_which_university(
index, name_of_the_lecture, n_ects, leistung_erbracht_am, which_university
)
}
report_total_amount_of_ects_points(total_ects_points, :master)
end
|
#show_only_practical_courses_that_were_passed_already ⇒ Object
#
show_only_practical_courses_that_were_passed_already
Use this method if you wish to show only practical courses that were passed already.
The currently acknowledged practical courses include UE, PR and LU.
Invocation example:
emo --übungen
#
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1436
def show_only_practical_courses_that_were_passed_already
@show_average_ects_passed_per_exam = false _ = dataset?
_.select! {|entry|
type_of_lecture = entry[6].strip
type_of_lecture.include?('UE') or
type_of_lecture.include?('PR') or
type_of_lecture.include?('LU')
}
reset_main_hash
sanitize_dataset(_, :leave_time_entry_alone)
report_main_hash
end
|
#show_the_summary ⇒ Object
Also known as:
show_only_the_summary
#
show_the_summary
To use this method from the commandline, do:
emo --summary
#
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2339
def show_the_summary
determine_n_ects_points_in_total
determine_n_exams_in_total_were_passed
determine_n_hours_were_passed_in_total report_how_many_exams_were_passed_in_total(@n_exams_in_total_passed)
report_how_many_hours_were_passed_in_total
report_how_many_ects_points_have_been_gathered_so_far
if @show_average_ects_passed_per_exam
report_the_average_amount_of_ects_per_passed_exam
end
report_the_average_grade
end
|
#show_the_years_in_a_short_table_overview ⇒ Object
#
show_the_years_in_a_short_table_overview
To invoke this method, do:
emo --years
#
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 1885
def show_the_years_in_a_short_table_overview
total_ects = 0
_ = dataset? _.map! {|inner_array|
n_ects_points = inner_array[2] [inner_array[0].split('.').last, n_ects_points]
}
current_year = Date.today.year total_ects_points_in_that_year = 0
e
e steelblue('Year')+
sfancy(' n ECTS points')
show_colourized_line
_.each {|year, n_ects_points|
year = year.to_i
n_ects_points = n_ects_points.to_f
total_ects += n_ects_points
if current_year == year
total_ects_points_in_that_year += n_ects_points
else
e ' '+
steelblue(( (current_year.to_s+': ') ).ljust(15))+
sfancy(total_ects_points_in_that_year.to_s.rjust(5)+' ECTS points')
total_ects_points_in_that_year = 0
current_year = year
total_ects_points_in_that_year += n_ects_points
end
}
show_colourized_line
e (' ' * 16)+sfancy(total_ects.to_s+' ECTS points')
e
end
|
#show_total_summary_for_year_hours_ects_n_exams(last_year, total_n_hours_passed_in_this_year, total_n_ects_passed_in_this_year, total_n_exams_passed_in_this_year, optional_average_grade_per_exam = nil) ⇒ Object
#
show_total_summary_for_year_hours_ects_n_exams
This method will show the total summary for a given year.
#
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 2044
def show_total_summary_for_year_hours_ects_n_exams(
last_year,
total_n_hours_passed_in_this_year,
total_n_ects_passed_in_this_year,
total_n_exams_passed_in_this_year,
optional_average_grade_per_exam = nil )
if @show_only_this_year and
@show_only_this_year.include?('-') and
@show_only_this_year.split('-').last.to_i < last_year
elsif @show_only_this_year and
(@show_only_this_year != last_year)
else
e result = "#{rev}Total Summary in #{sfancy(last_year.to_s)}#{rev}: "+
colourize_hours(
total_n_hours_passed_in_this_year.to_s.rjust(4)
)+' '
if show_ects_points?
result << colourize_ects(
total_n_ects_passed_in_this_year.to_f.to_s.rjust(5)+
' ECTS passed'
)
end
result << colourize_n_exams(' (n exams passed that year: '+
total_n_exams_passed_in_this_year.to_s.rjust(3)+')',
:mediumseagreen
)
e result
if @show_yearly_average_grades and optional_average_grade_per_exam
if block_given?
yielded = yield
if yielded.is_a? Hash
if yielded.has_key? :exclude_n_exams_from_the_grade_list
total_n_exams_passed_in_this_year -= yielded[:exclude_n_exams_from_the_grade_list].to_i
end
end
end
_ = (
optional_average_grade_per_exam.to_f / total_n_exams_passed_in_this_year.to_f
).round(2)
_ = _.to_s.ljust(4,'0')
padded_result = _.to_s.rjust(50)
e "#{rev}The average grade of the exams passed in this year is: "\
"#{sfancy(padded_result)}"
end
end
end
|
#store_result ⇒ Object
381
382
383
384
385
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 381
def store_result
set_store_where '/SOURCE_FILES.png'
opne "We will store at `#{sfile(store_where?)}`."
@g.write(store_where?)
end
|
#store_where? ⇒ Boolean
367
368
369
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 367
def store_where?
@store_where
end
|
#title? ⇒ Boolean
390
391
392
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 390
def title?
TITLE
end
|
#use_only_master_lectures ⇒ Object
#
use_only_master_lectures
#
304
305
306
307
308
309
310
|
# File 'lib/studium/exams/exams_per_month/exams_per_month.rb', line 304
def use_only_master_lectures
set_dataset(
dataset?.select {|entry| entry[5].include? 'M' }
)
reset_main_hash
sanitize_dataset(dataset?)
end
|