studium 0.16.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of studium might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +3211 -0
- data/bin/ask_exam_question +7 -0
- data/bin/check_description_of_these_lectures +7 -0
- data/bin/curriculum_module_displayer +7 -0
- data/bin/cycle +7 -0
- data/bin/d10 +7 -0
- data/bin/d100 +7 -0
- data/bin/d15 +7 -0
- data/bin/d20 +7 -0
- data/bin/d25 +7 -0
- data/bin/d3 +7 -0
- data/bin/d30 +7 -0
- data/bin/d5 +7 -0
- data/bin/determine_curricula +7 -0
- data/bin/display_lecture_url +7 -0
- data/bin/exam_registration_at +7 -0
- data/bin/exam_statistics +7 -0
- data/bin/exams_per_month +9 -0
- data/bin/finished_exams_at_this_university +7 -0
- data/bin/flashcards +7 -0
- data/bin/from_curriculum_id_to_university +9 -0
- data/bin/location_to_this_exam_topic.rb +7 -0
- data/bin/mandatory_continuous_assessment +7 -0
- data/bin/mandatory_upcoming_courses +10 -0
- data/bin/n_ECTS +7 -0
- data/bin/n_exam_questions_already_answered +16 -0
- data/bin/nquestions +7 -0
- data/bin/nsolved +7 -0
- data/bin/open_last_exam_question_asked_file +7 -0
- data/bin/passed_exams +7 -0
- data/bin/passed_pr/303/274fungsimmanente_courses +7 -0
- data/bin/pdf_for +7 -0
- data/bin/random_exam_topic +7 -0
- data/bin/report_solved_topics +7 -0
- data/bin/return_n_ects_from_this_file +7 -0
- data/bin/return_n_questions_solved_in_total +7 -0
- data/bin/rti_conflict +7 -0
- data/bin/search_for_n_ects +7 -0
- data/bin/show_lectures_on_the_commandline +7 -0
- data/bin/show_passed_exams_having_this_grade +7 -0
- data/bin/show_themes +7 -0
- data/bin/solved +9 -0
- data/bin/solved_ects +7 -0
- data/bin/studienkennzahl +7 -0
- data/bin/studium +7 -0
- data/bin/studium_skeleton +7 -0
- data/bin/ufind +7 -0
- data/bin/upcoming_exams +7 -0
- data/bin/week_parser +7 -0
- data/doc/ECTS_CONSIDERATIONS/ECTS_CONSIDERATIONS.md +82 -0
- data/doc/HOW_TO_DETERMINE_WHICH_PART_IS_THE_QUESTION_AND_WHICH_PART_IS_THE_ANSWER/HOW_TO_DETERMINE_WHICH_PART_IS_THE_QUESTION_AND_WHICH_PART_IS_THE_ANSWER.md +44 -0
- data/doc/README.gen +3164 -0
- data/doc/SQL_database_specification/SQL_database_specification.md +46 -0
- data/doc/deprecated_components/deprecated_components.md +46 -0
- data/doc/documentation_for_the_file_lecture_information/documentation_for_the_file_lecture_information.md +311 -0
- data/doc/elegant_colours/elegant_colours.md +21 -0
- data/doc/statistics/yearly_statistics.md +8 -0
- data/doc/todo/todo_for_the_graphical_parts_of_the_studium_gem_including_www_related_aspects.md +92 -0
- data/doc/todo/todo_for_the_studium_gem.md +55 -0
- data/img/STUDIES.png +0 -0
- data/lib/studium/autoinclude.rb +7 -0
- data/lib/studium/base/base.rb +3229 -0
- data/lib/studium/base/colours.rb +246 -0
- data/lib/studium/base/commandline_arguments_module/commandline_arguments_module.rb +115 -0
- data/lib/studium/base/prototype/prototype.rb +230 -0
- data/lib/studium/base/runmode_module/runmode_module.rb +103 -0
- data/lib/studium/c/README.md +2 -0
- data/lib/studium/c/a.out +0 -0
- data/lib/studium/c/obtain_random_entry.c +11 -0
- data/lib/studium/check_and_sanitize/README.md +15 -0
- data/lib/studium/check_and_sanitize/check_curriculum_for_correct_separation_of_bachelor_and_master.rb +141 -0
- data/lib/studium/check_and_sanitize/check_for_all_exam_topics_being_registered.rb +118 -0
- data/lib/studium/check_and_sanitize/check_for_correct_themes_of_each_course.rb +100 -0
- data/lib/studium/check_and_sanitize/check_for_existing_description_of_this_lecture.rb +194 -0
- data/lib/studium/check_and_sanitize/check_important_exams.rb +132 -0
- data/lib/studium/check_and_sanitize/check_the_lecture_information_file.rb +166 -0
- data/lib/studium/check_and_sanitize/find_duplicate_lectures.rb +124 -0
- data/lib/studium/check_and_sanitize/missing_priority_entry.rb +44 -0
- data/lib/studium/check_and_sanitize/sanitize_lecture_information.rb +427 -0
- data/lib/studium/check_and_sanitize/sanitize_this_string_containing_the_lva_dates.rb +79 -0
- data/lib/studium/colours/colours.rb +587 -0
- data/lib/studium/colours/sfancy.rb +49 -0
- data/lib/studium/colours/sfile.rb +39 -0
- data/lib/studium/colours/simp.rb +40 -0
- data/lib/studium/colours/use_colours.rb +39 -0
- data/lib/studium/colours/use_this_colour_for_exam_questions_and_exam_answers.rb +80 -0
- data/lib/studium/commandline/commandline.rb +1839 -0
- data/lib/studium/constants/colours.rb +16 -0
- data/lib/studium/constants/constants.rb +533 -0
- data/lib/studium/constants/curricula_related_constants.rb +504 -0
- data/lib/studium/constants/exam_topics.rb +156 -0
- data/lib/studium/constants/file_lecture_information.rb +55 -0
- data/lib/studium/constants/image_constants.rb +272 -0
- data/lib/studium/constants/regexes.rb +58 -0
- data/lib/studium/constants/roebe_specific_constants.rb +216 -0
- data/lib/studium/constants/standalone_constants.rb +372 -0
- data/lib/studium/constants/web_constants.rb +28 -0
- data/lib/studium/css/project.css +267 -0
- data/lib/studium/curricula/attribute_lecture_to_curriculum/attribute_boku_lecture_to_curriculum.rb +384 -0
- data/lib/studium/curricula/attribute_lecture_to_curriculum/attribute_lecture_to_curriculum.rb +238 -0
- data/lib/studium/curricula/curricula_from_this_website/curricula_from_this_website.rb +141 -0
- data/lib/studium/curricula/curriculum.rb +213 -0
- data/lib/studium/curricula/curriculum_as_string.rb +280 -0
- data/lib/studium/curricula/curriculum_module_displayer/constants.rb +33 -0
- data/lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb +417 -0
- data/lib/studium/curricula/curriculum_module_displayer/initialize.rb +25 -0
- data/lib/studium/curricula/curriculum_module_displayer/menu.rb +45 -0
- data/lib/studium/curricula/curriculum_module_displayer/reset.rb +74 -0
- data/lib/studium/curricula/curriculum_module_displayer/run.rb +20 -0
- data/lib/studium/curricula/curriculum_module_displayer/set_use_this_curriculum.rb +93 -0
- data/lib/studium/curricula/curriculum_module_displayer/show_and_report.rb +190 -0
- data/lib/studium/curricula/determine_curricula/constants.rb +11 -0
- data/lib/studium/curricula/determine_curricula/determine_curricula.rb +36 -0
- data/lib/studium/curricula/determine_curricula/help.rb +39 -0
- data/lib/studium/curricula/determine_curricula/initialize.rb +48 -0
- data/lib/studium/curricula/determine_curricula/menu.rb +151 -0
- data/lib/studium/curricula/determine_curricula/misc.rb +403 -0
- data/lib/studium/curricula/determine_curricula/report.rb +143 -0
- data/lib/studium/curricula/determine_curricula/reset.rb +59 -0
- data/lib/studium/curricula/determine_curricula/run.rb +19 -0
- data/lib/studium/curricula/determine_elective_courses_in_this_curriculum.rb +112 -0
- data/lib/studium/curricula/display_bachelor_curricula.rb +90 -0
- data/lib/studium/curricula/handle_curricula/README.md +9 -0
- data/lib/studium/curricula/handle_curricula/handle_curricula.rb +100 -0
- data/lib/studium/curricula/handle_curricula/misc.rb +798 -0
- data/lib/studium/curricula/mitteilungsbl/303/244tter/mitteilungsbl/303/244tter.rb +323 -0
- data/lib/studium/curricula/modules/display_on_the_commandline.rb +319 -0
- data/lib/studium/curricula/modules/return_n_ects_in_this_module.rb +75 -0
- data/lib/studium/curricula/n_percent_solved_in_this_curriculum.rb +75 -0
- data/lib/studium/curricula/prepare_individual_curriculum.rb +304 -0
- data/lib/studium/curricula/random_curriculum_creator/random_curriculum_creator.rb +164 -0
- data/lib/studium/curricula/show_all_unfinished_courses_of_this_curriculum/show_all_unfinished_courses_of_this_curriculum.rb +116 -0
- data/lib/studium/curricula/show_lectures_of_this_curriculum.rb +114 -0
- data/lib/studium/curricula/show_lectures_of_this_curriculum_id/show_lectures_of_this_curriculum_id.rb +554 -0
- data/lib/studium/curricula/show_solved_percentage_among_the_registered_curricula.rb +87 -0
- data/lib/studium/curricula/sorted_individual_curricula.rb +121 -0
- data/lib/studium/ects/boku_ects_splitter.rb +128 -0
- data/lib/studium/ects/ects_per_university/ects_per_university.rb +179 -0
- data/lib/studium/ects/ects_scanner.rb +141 -0
- data/lib/studium/ects/ects_to_university_parser.rb +142 -0
- data/lib/studium/ects/last_entry_is_curriculum.rb +150 -0
- data/lib/studium/ects/n_ects_in_these_lectures.rb +196 -0
- data/lib/studium/ects/n_ects_points_in_mandatory_presence_courses.rb +50 -0
- data/lib/studium/ects/return_n_ects_from_this_file.rb +59 -0
- data/lib/studium/ects/return_n_ects_from_this_url.rb +197 -0
- data/lib/studium/ects/search_for_n_ects/OLD_search_for_n_ects.rb +0 -0
- data/lib/studium/ects/search_for_n_ects/search_for_n_ects.rb +719 -0
- data/lib/studium/ects/show_completed_ects_in_all_curricula.rb +232 -0
- data/lib/studium/ects/show_passed_credits_per_curriculum.rb +276 -0
- data/lib/studium/ects/simple_total_ects_points.rb +135 -0
- data/lib/studium/ects/solved_ects/constants.rb +19 -0
- data/lib/studium/ects/solved_ects/reset.rb +51 -0
- data/lib/studium/ects/solved_ects/solved_ects.rb +325 -0
- data/lib/studium/ects/solved_ects_per_university/reset.rb +25 -0
- data/lib/studium/ects/solved_ects_per_university/solved_ects_per_university.rb +106 -0
- data/lib/studium/ects/still_missing.rb +129 -0
- data/lib/studium/ects/sum_of_ects.rb +144 -0
- data/lib/studium/encoding/encoding.rb +109 -0
- data/lib/studium/exam_topics/RNAi_siRNA_and_miRNA +100 -0
- data/lib/studium/exam_topics/abfall_als_ressource +86 -0
- data/lib/studium/exam_topics/advanced_biochemistry +927 -0
- data/lib/studium/exam_topics/advanced_biotechnology +234 -0
- data/lib/studium/exam_topics/advanced_cellbiology +219 -0
- data/lib/studium/exam_topics/advanced_chemistry +527 -0
- data/lib/studium/exam_topics/advanced_immunology +152 -0
- data/lib/studium/exam_topics/advanced_microbiology +44 -0
- data/lib/studium/exam_topics/advanced_topics_in_plant_sciences +109 -0
- data/lib/studium/exam_topics/advanced_virology +245 -0
- data/lib/studium/exam_topics/ageing +153 -0
- data/lib/studium/exam_topics/agrar_ecology +67 -0
- data/lib/studium/exam_topics/agrarmarkt +73 -0
- data/lib/studium/exam_topics/agrarphysik +35 -0
- data/lib/studium/exam_topics/alcohols +31 -0
- data/lib/studium/exam_topics/algorithms +77 -0
- data/lib/studium/exam_topics/allergie +76 -0
- data/lib/studium/exam_topics/allgemeine_genetik +1006 -0
- data/lib/studium/exam_topics/allgemeine_mikrobiologie +1008 -0
- data/lib/studium/exam_topics/aminoacids +464 -0
- data/lib/studium/exam_topics/analytische_chemie_1 +133 -0
- data/lib/studium/exam_topics/analytische_chemie_2 +31 -0
- data/lib/studium/exam_topics/anatomie +295 -0
- data/lib/studium/exam_topics/anorganische_chemie +350 -0
- data/lib/studium/exam_topics/anthropologie +138 -0
- data/lib/studium/exam_topics/antibodies_and_antigens +791 -0
- data/lib/studium/exam_topics/apoptosis +35 -0
- data/lib/studium/exam_topics/archaea +112 -0
- data/lib/studium/exam_topics/archaeo_viruses +7 -0
- data/lib/studium/exam_topics/architecture +8 -0
- data/lib/studium/exam_topics/artificial_intelligence +89 -0
- data/lib/studium/exam_topics/atomemissionsspektrometrie +6 -0
- data/lib/studium/exam_topics/audio +11 -0
- data/lib/studium/exam_topics/bacteriophages +266 -0
- data/lib/studium/exam_topics/basic_biochemistry +1008 -0
- data/lib/studium/exam_topics/basic_biotechnology +1011 -0
- data/lib/studium/exam_topics/basic_chemistry +1007 -0
- data/lib/studium/exam_topics/basic_virology +1007 -0
- data/lib/studium/exam_topics/bauwesen +6 -0
- data/lib/studium/exam_topics/betriebssysteme +128 -0
- data/lib/studium/exam_topics/betriebswirtschaftslehre +29 -0
- data/lib/studium/exam_topics/bioanalytik_und_biosensoren +391 -0
- data/lib/studium/exam_topics/biochips +79 -0
- data/lib/studium/exam_topics/bioelektrochemie +57 -0
- data/lib/studium/exam_topics/biofilms +54 -0
- data/lib/studium/exam_topics/bioinformatics +511 -0
- data/lib/studium/exam_topics/biological_therapeutics +156 -0
- data/lib/studium/exam_topics/biologie +149 -0
- data/lib/studium/exam_topics/biomarkers +137 -0
- data/lib/studium/exam_topics/biomaterials +90 -0
- data/lib/studium/exam_topics/biomembranes +6 -0
- data/lib/studium/exam_topics/bionik +65 -0
- data/lib/studium/exam_topics/biophysik +34 -0
- data/lib/studium/exam_topics/biopolymers +10 -0
- data/lib/studium/exam_topics/bioprozesstechnik +149 -0
- data/lib/studium/exam_topics/bioressourcenmanagement +78 -0
- data/lib/studium/exam_topics/birds +5 -0
- data/lib/studium/exam_topics/bodenkunde +384 -0
- data/lib/studium/exam_topics/bodenmikrobiologie +40 -0
- data/lib/studium/exam_topics/cancerbiology +484 -0
- data/lib/studium/exam_topics/cell_cultures +229 -0
- data/lib/studium/exam_topics/cellbiology +1011 -0
- data/lib/studium/exam_topics/cellular_transport_and_protein_secretion +27 -0
- data/lib/studium/exam_topics/cellular_vesicles +11 -0
- data/lib/studium/exam_topics/cellulose +6 -0
- data/lib/studium/exam_topics/chemische_technologie_anorganischer_stoffe +209 -0
- data/lib/studium/exam_topics/chemische_technologie_organischer_stoffe +25 -0
- data/lib/studium/exam_topics/chemisches_labor +60 -0
- data/lib/studium/exam_topics/chemokines_and_cytokines +45 -0
- data/lib/studium/exam_topics/chemotaxis_quorum_sensing_and_motility_in_prokaryotes +116 -0
- data/lib/studium/exam_topics/citric_acid_cycle +84 -0
- data/lib/studium/exam_topics/clinical_microbiology +516 -0
- data/lib/studium/exam_topics/computer_science +308 -0
- data/lib/studium/exam_topics/computer_vision_and_computer_graphics +13 -0
- data/lib/studium/exam_topics/crispr +51 -0
- data/lib/studium/exam_topics/cyanobacteria +44 -0
- data/lib/studium/exam_topics/cytogenetics_and_chromosome_biology +579 -0
- data/lib/studium/exam_topics/databases_and_sql +126 -0
- data/lib/studium/exam_topics/dna_mutation_and_dna_repair +70 -0
- data/lib/studium/exam_topics/dna_replication +67 -0
- data/lib/studium/exam_topics/ecogenetics +26 -0
- data/lib/studium/exam_topics/ecological_agriculture +12 -0
- data/lib/studium/exam_topics/ecology +330 -0
- data/lib/studium/exam_topics/economy +218 -0
- data/lib/studium/exam_topics/electron_microscopy +7 -0
- data/lib/studium/exam_topics/elektronenmikroskopie +356 -0
- data/lib/studium/exam_topics/elektrophorese +132 -0
- data/lib/studium/exam_topics/elektrotechnik_und_elektrizit/303/244t +42 -0
- data/lib/studium/exam_topics/elisa +55 -0
- data/lib/studium/exam_topics/embryologie_und_entwicklung +650 -0
- data/lib/studium/exam_topics/endospores_and_spores +104 -0
- data/lib/studium/exam_topics/enzymes_and_cofactors +393 -0
- data/lib/studium/exam_topics/epigenetik +187 -0
- data/lib/studium/exam_topics/erste_hilfe +174 -0
- data/lib/studium/exam_topics/ethik +143 -0
- data/lib/studium/exam_topics/evolution_and_evolutionary_genetics +367 -0
- data/lib/studium/exam_topics/excel +7 -0
- data/lib/studium/exam_topics/fish +19 -0
- data/lib/studium/exam_topics/fluorescence_microscopy +10 -0
- data/lib/studium/exam_topics/food_microbiology_and_food_biotechnology +92 -0
- data/lib/studium/exam_topics/forensik +11 -0
- data/lib/studium/exam_topics/forstwirtschaft +53 -0
- data/lib/studium/exam_topics/fortgeschrittene_genetik +643 -0
- data/lib/studium/exam_topics/fortgeschrittene_gentechnik +218 -0
- data/lib/studium/exam_topics/fortgeschrittene_physik +6 -0
- data/lib/studium/exam_topics/fungi +119 -0
- data/lib/studium/exam_topics/genetische_krankheiten +198 -0
- data/lib/studium/exam_topics/genexpression +1008 -0
- data/lib/studium/exam_topics/genomics_and_metagenomics +280 -0
- data/lib/studium/exam_topics/gentechnik_und_praktische_biochemie +954 -0
- data/lib/studium/exam_topics/geochemistry +67 -0
- data/lib/studium/exam_topics/geography +9 -0
- data/lib/studium/exam_topics/geologie_und_mineralogie +624 -0
- data/lib/studium/exam_topics/geometrie +56 -0
- data/lib/studium/exam_topics/geschichte +95 -0
- data/lib/studium/exam_topics/gluconeogenesis +72 -0
- data/lib/studium/exam_topics/glycogen +45 -0
- data/lib/studium/exam_topics/glycolysis +118 -0
- data/lib/studium/exam_topics/glykomik +121 -0
- data/lib/studium/exam_topics/glyoxylatzyklus +31 -0
- data/lib/studium/exam_topics/grassland_cultivation +32 -0
- data/lib/studium/exam_topics/hormone +148 -0
- data/lib/studium/exam_topics/html +8 -0
- data/lib/studium/exam_topics/human_ecology +8 -0
- data/lib/studium/exam_topics/hygiene +224 -0
- data/lib/studium/exam_topics/imaging_and_microscopy +267 -0
- data/lib/studium/exam_topics/immunanalytik +94 -0
- data/lib/studium/exam_topics/immunologie +1011 -0
- data/lib/studium/exam_topics/informatik +117 -0
- data/lib/studium/exam_topics/innate_immunity +42 -0
- data/lib/studium/exam_topics/insekten +64 -0
- data/lib/studium/exam_topics/insulin_and_diabetes +57 -0
- data/lib/studium/exam_topics/java +618 -0
- data/lib/studium/exam_topics/javascript +20 -0
- data/lib/studium/exam_topics/klima +6 -0
- data/lib/studium/exam_topics/kryptographie +9 -0
- data/lib/studium/exam_topics/landtechnik +26 -0
- data/lib/studium/exam_topics/lebensmittel_und_getr/303/244nke +223 -0
- data/lib/studium/exam_topics/lebensmitteltechnologie +16 -0
- data/lib/studium/exam_topics/light_microscopy +19 -0
- data/lib/studium/exam_topics/linux_and_unix +36 -0
- data/lib/studium/exam_topics/lipids +141 -0
- data/lib/studium/exam_topics/macroeconomics +39 -0
- data/lib/studium/exam_topics/marketing +7 -0
- data/lib/studium/exam_topics/mathematics +297 -0
- data/lib/studium/exam_topics/medizin_und_biomedizinische_technik +254 -0
- data/lib/studium/exam_topics/medizinische_chemie_und_pharmazie +437 -0
- data/lib/studium/exam_topics/messtechnik_und_regeltechnik +104 -0
- data/lib/studium/exam_topics/metabolismus +478 -0
- data/lib/studium/exam_topics/meteorologie_und_atmosph/303/244re +120 -0
- data/lib/studium/exam_topics/microbial_ecology +36 -0
- data/lib/studium/exam_topics/microcontrollers +11 -0
- data/lib/studium/exam_topics/mikrobielle_lebensgemeinschaften +54 -0
- data/lib/studium/exam_topics/mikrobielle_physiologie +285 -0
- data/lib/studium/exam_topics/mitochondria +40 -0
- data/lib/studium/exam_topics/mixed +287 -0
- data/lib/studium/exam_topics/molecular_biology_of_plants +272 -0
- data/lib/studium/exam_topics/molekulare_medizin +133 -0
- data/lib/studium/exam_topics/nanotechnologie +453 -0
- data/lib/studium/exam_topics/nature_conservation_and_biodiversity +244 -0
- data/lib/studium/exam_topics/naturstoffe +9 -0
- data/lib/studium/exam_topics/netzwerke +63 -0
- data/lib/studium/exam_topics/neurobiology +307 -0
- data/lib/studium/exam_topics/nucleotide_sequencing +41 -0
- data/lib/studium/exam_topics/nutztierethologie +11 -0
- data/lib/studium/exam_topics/object_oriented_modeling +14 -0
- data/lib/studium/exam_topics/obstbau +249 -0
- data/lib/studium/exam_topics/organische_chemie +1007 -0
- data/lib/studium/exam_topics/organische_chemie_2 +136 -0
- data/lib/studium/exam_topics/paleobiology +39 -0
- data/lib/studium/exam_topics/parasitic_diseases_and_molecular_infection_biology +336 -0
- data/lib/studium/exam_topics/patent_law +55 -0
- data/lib/studium/exam_topics/pathologie +731 -0
- data/lib/studium/exam_topics/pcr +155 -0
- data/lib/studium/exam_topics/pentosephosphatweg +61 -0
- data/lib/studium/exam_topics/peroxisomes_glycosomes_and_lysosomes +66 -0
- data/lib/studium/exam_topics/pflanzenanatomie +261 -0
- data/lib/studium/exam_topics/pflanzenbau +24 -0
- data/lib/studium/exam_topics/pflanzenschutz +35 -0
- data/lib/studium/exam_topics/pflanzenwissenschaften +1009 -0
- data/lib/studium/exam_topics/pharmaceutical_biotechnology +251 -0
- data/lib/studium/exam_topics/physik +446 -1
- data/lib/studium/exam_topics/physikalische_chemie +79 -0
- data/lib/studium/exam_topics/physiology_and_histology +536 -0
- data/lib/studium/exam_topics/phytochemie +33 -0
- data/lib/studium/exam_topics/plant_biotechnology +131 -0
- data/lib/studium/exam_topics/plant_breeding +64 -0
- data/lib/studium/exam_topics/plant_development +50 -0
- data/lib/studium/exam_topics/populationsgenetik +138 -0
- data/lib/studium/exam_topics/posttranslationale_modifikation_von_proteinen +197 -0
- data/lib/studium/exam_topics/projektmanagement +220 -0
- data/lib/studium/exam_topics/prokaryote_genetics +562 -0
- data/lib/studium/exam_topics/protein_engineering +35 -0
- data/lib/studium/exam_topics/proteolyse +38 -0
- data/lib/studium/exam_topics/proteomik +41 -0
- data/lib/studium/exam_topics/protozoans +24 -0
- data/lib/studium/exam_topics/prozesstechnik +95 -0
- data/lib/studium/exam_topics/psychologie +18 -0
- data/lib/studium/exam_topics/python +372 -0
- data/lib/studium/exam_topics/quality_management +266 -0
- data/lib/studium/exam_topics/rechtsgrundlagen +123 -0
- data/lib/studium/exam_topics/research_topics_in_immunobiology +42 -0
- data/lib/studium/exam_topics/rna_and_dna +519 -0
- data/lib/studium/exam_topics/rna_seq +13 -0
- data/lib/studium/exam_topics/robotics +12 -0
- data/lib/studium/exam_topics/ruby +238 -0
- data/lib/studium/exam_topics/ruby_on_rails +63 -0
- data/lib/studium/exam_topics/scientific_writing_and_publishing +38 -0
- data/lib/studium/exam_topics/semisynthese_von_proteinen_und_nukleotiden +120 -0
- data/lib/studium/exam_topics/sexualbiologie +183 -0
- data/lib/studium/exam_topics/signal_transduction_and_laser_systems +212 -0
- data/lib/studium/exam_topics/sozialbiologie +9 -0
- data/lib/studium/exam_topics/splicing_exons_and_introns +65 -0
- data/lib/studium/exam_topics/statistik +268 -0
- data/lib/studium/exam_topics/stemcells +181 -0
- data/lib/studium/exam_topics/stickstofffixierung +91 -0
- data/lib/studium/exam_topics/structural_bioinformatics +54 -0
- data/lib/studium/exam_topics/strukturbiologie +423 -0
- data/lib/studium/exam_topics/system_biology_and_synthetic_biology +108 -0
- data/lib/studium/exam_topics/systematische_zoologie +439 -0
- data/lib/studium/exam_topics/technical_ecology +144 -0
- data/lib/studium/exam_topics/technische_chemie +208 -0
- data/lib/studium/exam_topics/technische_grundlagen_der_informatik +39 -0
- data/lib/studium/exam_topics/technische_mikrobiologie +393 -0
- data/lib/studium/exam_topics/technisches_zeichnen +5 -0
- data/lib/studium/exam_topics/the_bacterial_cell_wall +98 -0
- data/lib/studium/exam_topics/the_c_plus_plus_programming_language +531 -0
- data/lib/studium/exam_topics/the_c_programming_language +133 -0
- data/lib/studium/exam_topics/the_cellcycle +98 -0
- data/lib/studium/exam_topics/the_european_union +121 -0
- data/lib/studium/exam_topics/the_interferon_system +39 -0
- data/lib/studium/exam_topics/the_microbiome +164 -0
- data/lib/studium/exam_topics/the_universe +31 -0
- data/lib/studium/exam_topics/theoretische_chemie +5 -0
- data/lib/studium/exam_topics/theoretische_informatik +161 -0
- data/lib/studium/exam_topics/thermodynamics +21 -0
- data/lib/studium/exam_topics/tierzucht +139 -0
- data/lib/studium/exam_topics/toxikologie +453 -0
- data/lib/studium/exam_topics/transcription +185 -0
- data/lib/studium/exam_topics/translation_ribosomes_and_translational_control +154 -0
- data/lib/studium/exam_topics/umweltbiotechnologie +64 -0
- data/lib/studium/exam_topics/umweltchemie +233 -0
- data/lib/studium/exam_topics/urbanism_and_traffic +19 -0
- data/lib/studium/exam_topics/urea_cycle +56 -0
- data/lib/studium/exam_topics/vaccines_and_vaccination +250 -0
- data/lib/studium/exam_topics/vectors_and_gene_therapy +247 -0
- data/lib/studium/exam_topics/verfahrenstechnik +37 -0
- data/lib/studium/exam_topics/verhaltensbiologie +56 -0
- data/lib/studium/exam_topics/veterinary_medicine +10 -0
- data/lib/studium/exam_topics/vitamine +32 -0
- data/lib/studium/exam_topics/wasserkunde +138 -0
- data/lib/studium/exam_topics/weinbau +86 -0
- data/lib/studium/exam_topics/wissenschaft +20 -0
- data/lib/studium/exam_topics/yeast +104 -0
- data/lib/studium/exam_topics/zoologie +334 -0
- data/lib/studium/exams/afterburn/afterburn.rb +304 -0
- data/lib/studium/exams/ask_exam_from_the_upcoming_exams_pool.rb +150 -0
- data/lib/studium/exams/ask_exam_question/ask_exam_question.rb +2757 -0
- data/lib/studium/exams/ask_exam_topic_question.rb +112 -0
- data/lib/studium/exams/ask_question_from_alias.rb +141 -0
- data/lib/studium/exams/ask_question_from_any_of_the_still_missing_lectures.rb +130 -0
- data/lib/studium/exams/ask_question_from_grouped_themes.rb +141 -0
- data/lib/studium/exams/ask_question_from_last_topic.rb +91 -0
- data/lib/studium/exams/ask_random_question.rb +195 -0
- data/lib/studium/exams/autoinclude.rb +7 -0
- data/lib/studium/exams/average_grade/average_grade.rb +402 -0
- data/lib/studium/exams/csv/create_csv_passed_exams_file.rb +217 -0
- data/lib/studium/exams/cycle.rb +291 -0
- data/lib/studium/exams/dataset/dataset.rb +128 -0
- data/lib/studium/exams/designate_ten_random_exam_topics/designate_ten_random_exam_topics.rb +88 -0
- data/lib/studium/exams/exam/exam.rb +130 -0
- data/lib/studium/exams/exam_bubble/exam_bubble.rb +445 -0
- data/lib/studium/exams/exam_bubble/menu_for_the_main_loop.rb +111 -0
- data/lib/studium/exams/exam_question/README.md +3 -0
- data/lib/studium/exams/exam_question/exam_question.rb +427 -0
- data/lib/studium/exams/exam_registration_at/constants.rb +49 -0
- data/lib/studium/exams/exam_registration_at/exam_registration_at.rb +242 -0
- data/lib/studium/exams/exam_registration_at/help.rb +46 -0
- data/lib/studium/exams/exam_registration_at/menu.rb +81 -0
- data/lib/studium/exams/exam_registration_at/report_and_show.rb +133 -0
- data/lib/studium/exams/exam_registration_at/reset.rb +54 -0
- data/lib/studium/exams/exam_statistics_from_this_file/exam_statistics_from_this_file.rb +119 -0
- data/lib/studium/exams/exam_topics.rb +194 -0
- data/lib/studium/exams/exams.rb +20 -0
- data/lib/studium/exams/exams_per_month/exams_per_month.rb +2429 -0
- data/lib/studium/exams/exams_this_week.rb +182 -0
- data/lib/studium/exams/fix_exam_dates.rb +121 -0
- data/lib/studium/exams/frozen.rb +36 -0
- data/lib/studium/exams/last_exams/last_exams.rb +398 -0
- data/lib/studium/exams/lectures_without_exam_entry.rb +137 -0
- data/lib/studium/exams/mandatory_continuous_assessment/mandatory_continuous_assessment.rb +1359 -0
- data/lib/studium/exams/move_all_unsolved_exam_questions_to_the_top_of_the_file.rb +173 -0
- data/lib/studium/exams/move_the_last_exam_question_to_the_top_of_the_file/move_the_last_exam_question_to_the_top_of_the_file.rb +111 -0
- data/lib/studium/exams/n_exams_in_these_topics.rb +477 -0
- data/lib/studium/exams/next_exam.rb +107 -0
- data/lib/studium/exams/next_exams.rb +378 -0
- data/lib/studium/exams/open_exam_associated_url/open_exam_associated_url.rb +154 -0
- data/lib/studium/exams/open_last_exam_question_asked_file/constants.rb +15 -0
- data/lib/studium/exams/open_last_exam_question_asked_file/initialize.rb +29 -0
- data/lib/studium/exams/open_last_exam_question_asked_file/open_last_exam_question_asked_file.rb +110 -0
- data/lib/studium/exams/push_solved_questions_on_top.rb +180 -0
- data/lib/studium/exams/questions_solved_from_day_to_day/questions_solved_from_day_to_day.rb +374 -0
- data/lib/studium/exams/remote_ftp_url.rb +52 -0
- data/lib/studium/exams/repeat_last_question.rb +78 -0
- data/lib/studium/exams/report_total_amount_of_questions_and_answers_for.rb +116 -0
- data/lib/studium/exams/show_all_passed_exams_of_this_university.rb +252 -0
- data/lib/studium/exams/show_backlog_of_exams/show_backlog_of_exams.rb +116 -0
- data/lib/studium/exams/show_next_exams_for.rb +133 -0
- data/lib/studium/exams/show_themes/constants.rb +28 -0
- data/lib/studium/exams/show_themes/menu.rb +61 -0
- data/lib/studium/exams/show_themes/misc.rb +537 -0
- data/lib/studium/exams/show_themes/reset.rb +62 -0
- data/lib/studium/exams/show_themes/show_themes.rb +27 -0
- data/lib/studium/exams/show_upcoming_exams/show_upcoming_exams.rb +1375 -0
- data/lib/studium/exams/solve_all_questions_from_this_topic.rb +114 -0
- data/lib/studium/exams/solved/constants.rb +32 -0
- data/lib/studium/exams/solved/help.rb +24 -0
- data/lib/studium/exams/solved/initialize.rb +55 -0
- data/lib/studium/exams/solved/menu.rb +41 -0
- data/lib/studium/exams/solved/reset.rb +28 -0
- data/lib/studium/exams/solved/solved.rb +326 -0
- data/lib/studium/exams/timetable/constants.rb +142 -0
- data/lib/studium/exams/timetable/timetable.rb +450 -0
- data/lib/studium/exams/unsolve_all_questions_from_this_topic.rb +163 -0
- data/lib/studium/exams/upcoming_exams/upcoming_exams.rb +556 -0
- data/lib/studium/exams/upcoming_exams_at_the_boku/constants.rb +23 -0
- data/lib/studium/exams/upcoming_exams_at_the_boku/html.rb +64 -0
- data/lib/studium/exams/upcoming_exams_at_the_boku/upcoming_exams_at_the_boku.rb +194 -0
- data/lib/studium/exams/upcoming_exams_dataset.rb +247 -0
- data/lib/studium/exams/upcoming_registered_exams/upcoming_registered_exams.rb +257 -0
- data/lib/studium/exams/upload_exam_topics.rb +360 -0
- data/lib/studium/graphviz/README.md +4 -0
- data/lib/studium/graphviz/bachelor_vector_based_strategies.dot +160 -0
- data/lib/studium/graphviz/master_vector_based_strategies.dot +46 -0
- data/lib/studium/gui/gtk3/README.md +1 -0
- data/lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.config +6 -0
- data/lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb +760 -0
- data/lib/studium/gui/gtk3/ask_exam_question/manifest.yml +12 -0
- data/lib/studium/gui/gtk3/control_panel/control_panel.rb +39 -0
- data/lib/studium/gui/gtk3/curriculum_viewer/curriculum_viewer.rb +513 -0
- data/lib/studium/gui/gtk3/ects_per_university/ects_per_university.rb +217 -0
- data/lib/studium/gui/gtk3/exam_question_widget/exam_question_widget.rb +1889 -0
- data/lib/studium/gui/gtk3/expand_time_range/expand_time_range.rb +34 -0
- data/lib/studium/gui/gtk3/information_about_a_lecture/information_about_a_lecture.rb +34 -0
- data/lib/studium/gui/gtk3/lecture_information/lecture_information.rb +200 -0
- data/lib/studium/gui/gtk3/show_upcoming_exams/show_upcoming_exams.rb +34 -0
- data/lib/studium/gui/java/exam_question/ExamQuestion$1.class +0 -0
- data/lib/studium/gui/java/exam_question/ExamQuestion.class +0 -0
- data/lib/studium/gui/java/exam_question/ExamQuestion.java +215 -0
- data/lib/studium/gui/javafx/exam_question_widget/exam_question_widget.rb +58 -0
- data/lib/studium/gui/jruby/exam_question_widget/exam_question_widget.rb +317 -0
- data/lib/studium/gui/libui/ask_exam_question/ask_exam_question.rb +349 -0
- data/lib/studium/gui/shared_code/control_panel/control_panel_module.rb +314 -0
- data/lib/studium/gui/shared_code/exam_question_widget/exam_question_widget_module.rb +39 -0
- data/lib/studium/gui/shared_code/expand_time_range/expand_time_range.css +0 -0
- data/lib/studium/gui/shared_code/expand_time_range/expand_time_range_module.rb +190 -0
- data/lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb +180 -0
- data/lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb +206 -0
- data/lib/studium/images/libui_ask_exam_question.png +0 -0
- data/lib/studium/images/outdated.png +0 -0
- data/lib/studium/images/small_logos/DNA.png +0 -0
- data/lib/studium/images/small_logos/README.md +2 -0
- data/lib/studium/images/small_logos/solved.png +0 -0
- data/lib/studium/images/studies_favicon.png +0 -0
- data/lib/studium/java/README.md +5 -0
- data/lib/studium/java/studium/AskExamQuestion.java +461 -0
- data/lib/studium/java/studium/Base.java +123 -0
- data/lib/studium/java/studium/Constants.java +122 -0
- data/lib/studium/java/studium/EnsureThatTheLogDirectoryExists.java +57 -0
- data/lib/studium/java/studium/Mkdir.java +13 -0
- data/lib/studium/java/studium/OpenLastExamQuestionurlLinkViaTheBrowser.java +90 -0
- data/lib/studium/java/studium/ReturnNQuestionsSolvedInTotal.java +69 -0
- data/lib/studium/java/studium/Solved.java +112 -0
- data/lib/studium/java/studium/Test.java +60 -0
- data/lib/studium/java/studium/studium/AskExamQuestion.class +0 -0
- data/lib/studium/java/studium/studium/Base.class +0 -0
- data/lib/studium/java/studium/studium/Constants.class +0 -0
- data/lib/studium/java/studium/studium/EnsureThatTheLogDirectoryExists.class +0 -0
- data/lib/studium/java/studium/studium/Mkdir.class +0 -0
- data/lib/studium/java/studium/studium/OpenLastExamQuestionurlLinkViaTheBrowser.class +0 -0
- data/lib/studium/java/studium/studium/ReturnNQuestionsSolvedInTotal.class +0 -0
- data/lib/studium/java/studium/studium/Solved.class +0 -0
- data/lib/studium/java/studium/studium/Test.class +0 -0
- data/lib/studium/jobs/jobs.rb +80 -0
- data/lib/studium/logging/README.md +2 -0
- data/lib/studium/logging/ensure_that_the_log_directory_exists.rb +58 -0
- data/lib/studium/logging/html_log_directory.rb +42 -0
- data/lib/studium/logging/log_directory.rb +112 -0
- data/lib/studium/logging/store_last_question_asked_into_file.rb +137 -0
- data/lib/studium/parsers/README.md +2 -0
- data/lib/studium/parsers/custom_exam_results_parser.rb +209 -0
- data/lib/studium/parsers/parse_lva_dates.rb +233 -0
- data/lib/studium/parsers/parse_remote_lecture.rb +331 -0
- data/lib/studium/project/project.rb +88 -0
- data/lib/studium/requires/common_popular_requires.rb +37 -0
- data/lib/studium/requires/commonly_used_requires.rb +14 -0
- data/lib/studium/requires/require_class_exams_solved.rb +7 -0
- data/lib/studium/requires/require_ects_scripts.rb +27 -0
- data/lib/studium/requires/require_encoding.rb +7 -0
- data/lib/studium/requires/require_the_check_and_sanitize_files.rb +31 -0
- data/lib/studium/requires/require_the_curricula_files.rb +28 -0
- data/lib/studium/requires/require_the_exam_question_class.rb +7 -0
- data/lib/studium/requires/require_the_exams_files.rb +46 -0
- data/lib/studium/requires/require_the_logging_files.rb +23 -0
- data/lib/studium/requires/require_the_parsers.rb +28 -0
- data/lib/studium/requires/require_the_studium_constants.rb +10 -0
- data/lib/studium/requires/require_the_studium_project.rb +70 -0
- data/lib/studium/requires/require_the_toplevel_methods.rb +27 -0
- data/lib/studium/requires/require_the_utility_scripts.rb +34 -0
- data/lib/studium/requires/require_upcoming_exams.rb +7 -0
- data/lib/studium/requires/require_yaml.rb +7 -0
- data/lib/studium/requires/return_remote_homepage_of_this_lecture.rb +7 -0
- data/lib/studium/requires/with_GUI.rb +13 -0
- data/lib/studium/requires/www_mode.rb +17 -0
- data/lib/studium/statistics/README.md +4 -0
- data/lib/studium/statistics/best_exam_months.rb +92 -0
- data/lib/studium/statistics/curriculum_comparer/curriculum_comparer.rb +386 -0
- data/lib/studium/statistics/determine_exam_statistics_from_this_file.rb +142 -0
- data/lib/studium/statistics/exam_topics_that_are_about_to_be_completed.rb +119 -0
- data/lib/studium/statistics/max_stats.rb +170 -0
- data/lib/studium/statistics/new_questions_per_year.rb +147 -0
- data/lib/studium/statistics/report_how_many_ects_points_per_curriculum_were_completed.rb +167 -0
- data/lib/studium/statistics/report_how_many_exam_questions_were_answered.rb +474 -0
- data/lib/studium/statistics/show_exam_statistics.rb +66 -0
- data/lib/studium/statistics/show_which_courses_are_in_a_bachelor_or_master_curriculum_respectively.rb +104 -0
- data/lib/studium/statistics/top_stats.rb +127 -0
- data/lib/studium/toplevel_methods/all_passed_exams.rb +37 -0
- data/lib/studium/toplevel_methods/already_solved_this_lecture.rb +101 -0
- data/lib/studium/toplevel_methods/available_topics.rb +161 -0
- data/lib/studium/toplevel_methods/calculate_pr/303/274fungsimmanente_lectures_from_this_file.rb +55 -0
- data/lib/studium/toplevel_methods/copy_the_last_backup_of_file_lecture_information.rb +34 -0
- data/lib/studium/toplevel_methods/curriculum_related_code.rb +1038 -0
- data/lib/studium/toplevel_methods/does_this_course_require_mandatory_presence.rb +52 -0
- data/lib/studium/toplevel_methods/download.rb +161 -0
- data/lib/studium/toplevel_methods/e.rb +16 -0
- data/lib/studium/toplevel_methods/ects_from_lectures.rb +250 -0
- data/lib/studium/toplevel_methods/editor.rb +67 -0
- data/lib/studium/toplevel_methods/esystem.rb +29 -0
- data/lib/studium/toplevel_methods/filter_away_invalid_questions.rb +77 -0
- data/lib/studium/toplevel_methods/find_exam_topic_and_exam_title.rb +3807 -0
- data/lib/studium/toplevel_methods/has_this_lecture_been_already_passed_but_the_id_was_changed_lateron.rb +42 -0
- data/lib/studium/toplevel_methods/has_this_module_been_completed.rb +208 -0
- data/lib/studium/toplevel_methods/install_the_project_on_the_given_hostsystem.rb +32 -0
- data/lib/studium/toplevel_methods/is_on_roebe.rb +27 -0
- data/lib/studium/toplevel_methods/is_this_exam_topic_included.rb +46 -0
- data/lib/studium/toplevel_methods/is_this_homepage_registered.rb +32 -0
- data/lib/studium/toplevel_methods/is_this_lecture_a_practical_course.rb +93 -0
- data/lib/studium/toplevel_methods/is_this_lecture_registered_in_upcoming_exams.rb +45 -0
- data/lib/studium/toplevel_methods/java.rb +32 -0
- data/lib/studium/toplevel_methods/lecture_information.rb +108 -0
- data/lib/studium/toplevel_methods/lva_numbers.rb +358 -0
- data/lib/studium/toplevel_methods/main_dataset.rb +73 -0
- data/lib/studium/toplevel_methods/map_input_to_this_curriculum_filename.rb +607 -0
- data/lib/studium/toplevel_methods/methods_related_to_files_and_directories.rb +481 -0
- data/lib/studium/toplevel_methods/misc.rb +580 -0
- data/lib/studium/toplevel_methods/n_questions_available.rb +141 -0
- data/lib/studium/toplevel_methods/n_topics_available.rb +63 -0
- data/lib/studium/toplevel_methods/names_of_all_solved_exams.rb +77 -0
- data/lib/studium/toplevel_methods/note_down_the_start_time_and_how_many_exams_have_been_already_solved.rb +69 -0
- data/lib/studium/toplevel_methods/opnn.rb +27 -0
- data/lib/studium/toplevel_methods/passed_this_exam_on.rb +105 -0
- data/lib/studium/toplevel_methods/read_delay_between_questions_from_file.rb +36 -0
- data/lib/studium/toplevel_methods/regexes.rb +90 -0
- data/lib/studium/toplevel_methods/registered_for_this_exam.rb +83 -0
- data/lib/studium/toplevel_methods/remove_comments.rb +27 -0
- data/lib/studium/toplevel_methods/remove_exam_topics_that_were_already_answered.rb +27 -0
- data/lib/studium/toplevel_methods/remove_tags.rb +35 -0
- data/lib/studium/toplevel_methods/report.rb +439 -0
- data/lib/studium/toplevel_methods/return_all_exams_on_this_day.rb +69 -0
- data/lib/studium/toplevel_methods/return_dataset_for_this_exam_topic.rb +45 -0
- data/lib/studium/toplevel_methods/return_ects_from_this_lecture_stored_in_the_file_lecture_information.rb +194 -0
- data/lib/studium/toplevel_methods/return_hash_of_already_solved_lectures.rb +46 -0
- data/lib/studium/toplevel_methods/return_last_exam_question.rb +34 -0
- data/lib/studium/toplevel_methods/return_lva_number_of_this_lecture.rb +72 -0
- data/lib/studium/toplevel_methods/return_n_percent_solved_from_this_topic.rb +90 -0
- data/lib/studium/toplevel_methods/return_n_questions_were_answered_for_this_topic.rb +62 -0
- data/lib/studium/toplevel_methods/return_proper_university_image.rb +86 -0
- data/lib/studium/toplevel_methods/return_question_answer_string_from_this_topic.rb +63 -0
- data/lib/studium/toplevel_methods/return_remote_homepage_of_this_lecture.rb +11311 -0
- data/lib/studium/toplevel_methods/return_remote_moodle_link_of_this_lecture.rb +2405 -0
- data/lib/studium/toplevel_methods/return_sanitized_dataset_from_the_file_lecture_information.rb +110 -0
- data/lib/studium/toplevel_methods/return_theme_of_the_next_upcoming_exam.rb +40 -0
- data/lib/studium/toplevel_methods/runmode.rb +97 -0
- data/lib/studium/toplevel_methods/sanitized_dataset_from_file_passed_exams_per_month.rb +53 -0
- data/lib/studium/toplevel_methods/set_last_file_for_exam_questions.rb +64 -0
- data/lib/studium/toplevel_methods/set_this_cd_alias_to.rb +92 -0
- data/lib/studium/toplevel_methods/spacer.rb +18 -0
- data/lib/studium/toplevel_methods/time.rb +297 -0
- data/lib/studium/toplevel_methods/total_ects_points_passed.rb +73 -0
- data/lib/studium/toplevel_methods/try_to_guess_the_most_likely_lva_id.rb +58 -0
- data/lib/studium/toplevel_methods/try_to_return_the_expanded_name_of_this_lecture.rb +64 -0
- data/lib/studium/toplevel_methods/unfinished.rb +51 -0
- data/lib/studium/toplevel_methods/url.rb +106 -0
- data/lib/studium/toplevel_methods/verbose_truth.rb +36 -0
- data/lib/studium/toplevel_methods/when_was_this_lecture_passed.rb +54 -0
- data/lib/studium/toplevel_methods/word_wrap.rb +56 -0
- data/lib/studium/toplevel_methods/write_into_file_related_functionality.rb +197 -0
- data/lib/studium/toplevel_methods/yes_or_no_ja_oder_nein.rb +33 -0
- data/lib/studium/universities_in_austria/README.md +2 -0
- data/lib/studium/universities_in_austria/boku/README.md +4 -0
- data/lib/studium/universities_in_austria/boku/boku_/303/266ffnungszeiten.rb +28 -0
- data/lib/studium/universities_in_austria/boku/show_three_pillars_of_these_lectures.rb +110 -0
- data/lib/studium/universities_in_austria/boku/three_pillars.rb +237 -0
- data/lib/studium/universities_in_austria/tu_vienna/README.md +6 -0
- data/lib/studium/universities_in_austria/tu_vienna/tu_ferien.rb +42 -0
- data/lib/studium/universities_in_austria/tu_vienna/tu_/303/266ffnungszeiten.rb +34 -0
- data/lib/studium/university_course/university_course.rb +409 -0
- data/lib/studium/utility_scripts/attribute_lectures_to_university/attribute_lectures_to_university.rb +375 -0
- data/lib/studium/utility_scripts/audio_stats.rb +171 -0
- data/lib/studium/utility_scripts/auto_stud/auto_stud.rb +252 -0
- data/lib/studium/utility_scripts/auto_stud/constants.rb +18 -0
- data/lib/studium/utility_scripts/auto_stud/initialize.rb +23 -0
- data/lib/studium/utility_scripts/auto_stud/misc.rb +18 -0
- data/lib/studium/utility_scripts/autopurge_this_lecture_date.rb +93 -0
- data/lib/studium/utility_scripts/average_grade_of_this_curriculum.rb +155 -0
- data/lib/studium/utility_scripts/blocked_courses.rb +146 -0
- data/lib/studium/utility_scripts/calendar/README.md +2 -0
- data/lib/studium/utility_scripts/calendar/calendar.rb +251 -0
- data/lib/studium/utility_scripts/calendar/misc.rb +35 -0
- data/lib/studium/utility_scripts/check_description_of_these_lectures.rb +221 -0
- data/lib/studium/utility_scripts/course_registrations/course_registrations.rb +98 -0
- data/lib/studium/utility_scripts/courses/courses.rb +177 -0
- data/lib/studium/utility_scripts/create/README.md +2 -0
- data/lib/studium/utility_scripts/create/webpage_of_university.rb +129 -0
- data/lib/studium/utility_scripts/create/webpage_of_university_BOKU.rb +61 -0
- data/lib/studium/utility_scripts/create/webpage_of_university_TU.rb +60 -0
- data/lib/studium/utility_scripts/create/webpage_of_university_UniWien.rb +60 -0
- data/lib/studium/utility_scripts/create_database/create_database.rb +106 -0
- data/lib/studium/utility_scripts/current_lectures_belonging_to_both_bachelor_and_master_curriculum.rb +113 -0
- data/lib/studium/utility_scripts/currently_participating_in_these_lectures/currently_participating_in_these_lectures.rb +104 -0
- data/lib/studium/utility_scripts/display_lecture_url/display_lecture_url.rb +176 -0
- data/lib/studium/utility_scripts/expand_time_range/expand_time_range.rb +521 -0
- data/lib/studium/utility_scripts/finished_exams_at_this_university/finished_exams_at_this_university.rb +173 -0
- data/lib/studium/utility_scripts/foreign_language_percentage/constants.rb +23 -0
- data/lib/studium/utility_scripts/foreign_language_percentage/foreign_language_percentage.rb +149 -0
- data/lib/studium/utility_scripts/foreign_language_percentage/help.rb +31 -0
- data/lib/studium/utility_scripts/foreign_language_percentage/initialize.rb +25 -0
- data/lib/studium/utility_scripts/foreign_language_percentage/menu.rb +158 -0
- data/lib/studium/utility_scripts/foreign_language_percentage/report.rb +62 -0
- data/lib/studium/utility_scripts/foreign_language_percentage/reset.rb +50 -0
- data/lib/studium/utility_scripts/foreign_language_percentage/run.rb +19 -0
- data/lib/studium/utility_scripts/generate_spreadsheet/generate_spreadsheet.rb +354 -0
- data/lib/studium/utility_scripts/generate_spreadsheet/misc.rb +144 -0
- data/lib/studium/utility_scripts/holidays/holidays.rb +156 -0
- data/lib/studium/utility_scripts/homepage_of_these_courses/homepage_of_these_courses.rb +125 -0
- data/lib/studium/utility_scripts/lectures_attributed_to_universities/lectures_attributed_to_universities.rb +336 -0
- data/lib/studium/utility_scripts/lva_dates_of_the_important_courses.rb +111 -0
- data/lib/studium/utility_scripts/lva_nummer/lva_nummer.rb +431 -0
- data/lib/studium/utility_scripts/mandatory_lectures_in_this_month/mandatory_lectures_in_this_month.rb +316 -0
- data/lib/studium/utility_scripts/moodle/moodle.rb +213 -0
- data/lib/studium/utility_scripts/name_of_this_lva_id/name_of_this_lva_id.rb +110 -0
- data/lib/studium/utility_scripts/new_stud.rb +324 -0
- data/lib/studium/utility_scripts/next_week/next_week.rb +103 -0
- data/lib/studium/utility_scripts/not_yet_registered/not_yet_registered.rb +120 -0
- data/lib/studium/utility_scripts/open_last_exam_question_url_link_via_the_browser.rb +76 -0
- data/lib/studium/utility_scripts/passed_ects_per_year/passed_ects_per_year.rb +313 -0
- data/lib/studium/utility_scripts/passed_pr/303/274fungsimmanente_courses/passed_pr/303/274fungsimmanente_courses.rb +181 -0
- data/lib/studium/utility_scripts/pdf/README.md +2 -0
- data/lib/studium/utility_scripts/pdf/create_pdf_file_for_this_exam_topic.rb +355 -0
- data/lib/studium/utility_scripts/pdf/hexapdf_support.rb +50 -0
- data/lib/studium/utility_scripts/preparatory_meetings/preparatory_meetings.rb +317 -0
- data/lib/studium/utility_scripts/priority/priority.rb +164 -0
- data/lib/studium/utility_scripts/priority_points/priority_points.rb +263 -0
- data/lib/studium/utility_scripts/publish_my_exams/publish_my_exams.rb +174 -0
- data/lib/studium/utility_scripts/regexes/README.md +1 -0
- data/lib/studium/utility_scripts/regexes/generate_regex.rb +314 -0
- data/lib/studium/utility_scripts/regexes/generate_regexes_for_the_available_moodle_links.rb +55 -0
- data/lib/studium/utility_scripts/regexes/generate_regexes_for_the_registered_lectures.rb +48 -0
- data/lib/studium/utility_scripts/report_outdated_timetable_entries/report_outdated_timetable_entries.rb +142 -0
- data/lib/studium/utility_scripts/report_whether_this_lecture_is_registered_in_the_file_lecture_information/report_whether_this_lecture_is_registered_in_the_file_lecture_information.rb +128 -0
- data/lib/studium/utility_scripts/resolve_practical_courses_date_conflicts/individual_resolve_practical_courses_date_conflicts.rb +254 -0
- data/lib/studium/utility_scripts/resolve_practical_courses_date_conflicts/resolve_practical_courses_date_conflicts.rb +265 -0
- data/lib/studium/utility_scripts/scrape_remote_university_url.rb +138 -0
- data/lib/studium/utility_scripts/semester_schedule_creator/semester_container.rb +144 -0
- data/lib/studium/utility_scripts/semester_schedule_creator/semester_schedule_creator.rb +374 -0
- data/lib/studium/utility_scripts/semesterplaner/semesterplaner.rb +311 -0
- data/lib/studium/utility_scripts/set_aliases_based_on_this_file.rb +97 -0
- data/lib/studium/utility_scripts/show_all_passed_master_lectures/show_all_passed_master_lectures.rb +126 -0
- data/lib/studium/utility_scripts/show_conflicting_lva_lectures/show_conflicting_lva_lectures.rb +1385 -0
- data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/constants.rb +23 -0
- data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/menu.rb +63 -0
- data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/reset.rb +33 -0
- data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/run.rb +50 -0
- data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/show_descriptions_of_lectures_belonging_to_this_module.rb +145 -0
- data/lib/studium/utility_scripts/show_lecturers/show_lecturers.rb +147 -0
- data/lib/studium/utility_scripts/show_lectures/show_lectures.rb +910 -0
- data/lib/studium/utility_scripts/show_lectures_fitting_to_this_language/show_lectures_fitting_to_this_language.rb +121 -0
- data/lib/studium/utility_scripts/show_lectures_fitting_to_this_theme/show_lectures_fitting_to_this_theme.rb +105 -0
- data/lib/studium/utility_scripts/show_lectures_on_the_commandline/show_lectures_on_the_commandline.rb +3167 -0
- data/lib/studium/utility_scripts/show_lectures_on_this_day/show_lectures_on_this_day.rb +150 -0
- data/lib/studium/utility_scripts/show_lva_dates_of_this_lecture/show_lva_dates_of_this_lecture.rb +182 -0
- data/lib/studium/utility_scripts/show_mixed_bachelor_master_courses/show_mixed_bachelor_master_courses.rb +92 -0
- data/lib/studium/utility_scripts/show_outdated_lva_dates/show_outdated_lva_dates.rb +214 -0
- data/lib/studium/utility_scripts/show_passed_exams_having_this_grade/show_passed_exams_having_this_grade.rb +91 -0
- data/lib/studium/utility_scripts/show_solved_english_lectures/show_solved_english_lectures.rb +139 -0
- data/lib/studium/utility_scripts/steop/README.md +4 -0
- data/lib/studium/utility_scripts/steop/show_all_steop_lectures.rb +93 -0
- data/lib/studium/utility_scripts/steop/steop_lectures_in_this_curriculum.rb +284 -0
- data/lib/studium/utility_scripts/steop/steop_lva_dates.rb +119 -0
- data/lib/studium/utility_scripts/studienkennzahl/studienkennzahl.rb +116 -0
- data/lib/studium/utility_scripts/studium_skeleton/studium_skeleton.rb +242 -0
- data/lib/studium/utility_scripts/stundenplan.rb +600 -0
- data/lib/studium/utility_scripts/sync_studium_relevant_entries_one_level_downwards.rb +217 -0
- data/lib/studium/utility_scripts/ufind/ufind.rb +106 -0
- data/lib/studium/utility_scripts/upcoming_mandatory_presence_courses/constants.rb +26 -0
- data/lib/studium/utility_scripts/upcoming_mandatory_presence_courses/run.rb +20 -0
- data/lib/studium/utility_scripts/upcoming_mandatory_presence_courses/upcoming_mandatory_presence_courses.rb +187 -0
- data/lib/studium/utility_scripts/video_lecture_downloader/video_lecture_downloader.rb +107 -0
- data/lib/studium/utility_scripts/week_parser/constants.rb +23 -0
- data/lib/studium/utility_scripts/week_parser/help.rb +32 -0
- data/lib/studium/utility_scripts/week_parser/menu.rb +59 -0
- data/lib/studium/utility_scripts/week_parser/misc.rb +373 -0
- data/lib/studium/utility_scripts/week_parser/reset.rb +65 -0
- data/lib/studium/utility_scripts/week_parser/run.rb +18 -0
- data/lib/studium/utility_scripts/week_parser/show.rb +236 -0
- data/lib/studium/utility_scripts/week_parser/week_parser.rb +49 -0
- data/lib/studium/utility_scripts/weekday_parser.rb +155 -0
- data/lib/studium/utility_scripts/weekly_schedule.rb +198 -0
- data/lib/studium/utility_scripts/wochenplanung/wochenplanung.rb +267 -0
- data/lib/studium/version/version.rb +46 -0
- data/lib/studium/www/exams/exams.cgi +54 -0
- data/lib/studium/www/fast_ask_exam_question/fast_ask_exam_question.cgi +156 -0
- data/lib/studium/www/handle_curricula/handle_curricula.cgi +154 -0
- data/lib/studium/www/next_generation_exam_question_trainer/next_generation_exam_question_trainer.cgi +112 -0
- data/lib/studium/www/next_generation_exam_question_trainer/solved.cgi +26 -0
- data/lib/studium/www/sinatra/app.rb +231 -0
- data/lib/studium/www/sinatra/curriculum_displayer/curriculum_displayer.rb +162 -0
- data/lib/studium/www/sinatra/misc.rb +115 -0
- data/lib/studium/www/statistics/statistics.cgi +82 -0
- data/lib/studium/www/upcoming_exams/upcoming_exams.cgi +36 -0
- data/lib/studium/yaml/ad_hoc_trainer/README.md +2 -0
- data/lib/studium/yaml/ad_hoc_trainer/exam_topics.md +22 -0
- data/lib/studium/yaml/allowed_themes_for_courses/allowed_themes_for_courses.yml +348 -0
- data/lib/studium/yaml/array_allowed_entries_for_the_file_lecture_information/array_allowed_entries_for_the_file_lecture_information.yml +71 -0
- data/lib/studium/yaml/available_exam_topics/available_exam_topics.yml +234 -0
- data/lib/studium/yaml/backlog_of_exams.yml +37 -0
- data/lib/studium/yaml/colours/custom_colours.yml +50 -0
- data/lib/studium/yaml/colours/use_colours.yml +1 -0
- data/lib/studium/yaml/current_exams.yml +30 -0
- data/lib/studium/yaml/curricula/README.md +39 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_agrarwissenschaften_033255.yml +147 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_basisblock_033630.yml +71 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_botanik_033630.yml +100 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_ecology_033630.yml +74 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_mikrobiologie_und_genetik_033630.yml +122 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_molekulare_biologie_033630.yml +106 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_zoologie_033630.yml +87 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_chemie_033662.yml +165 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_dummy_curriculum.yml +182 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_elektrotechnik_und_informationstechnik_033235.yml +13 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_forstwirtschaft_033225.yml +115 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_informatik_033521.yml +136 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_ktww_033231.yml +84 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_lmbt_033217.yml +121 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_medizinische_informatik_033533.yml +283 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_molekularbiologie_033665.yml +95 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_nutrition_science_033638.yml +119 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_pharmazie_033305.yml +170 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_technische_chemie_033290.yml +131 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_technische_informatik_033535.yml +23 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_ubrm_033227.yml +142 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_verfahrenstechnik_033273.yml +167 -0
- data/lib/studium/yaml/curricula/bachelor/bachelor_wirtschaftsinformatik_033526.yml +29 -0
- data/lib/studium/yaml/curricula/experimental/bachelor_informatik_in_den_lebenswissenschaften.yml +137 -0
- data/lib/studium/yaml/curricula/individual/bachelor_formale_logik.yml +88 -0
- data/lib/studium/yaml/curricula/individual/bachelor_informatik_und_molekulare_biologie.yml +1161 -0
- data/lib/studium/yaml/curricula/individual/bachelor_vector_based_strategies_in_life_sciences_molecular_medicine_and_biotechnology.yml +1157 -0
- data/lib/studium/yaml/curricula/individual/master_bioinformatics_and_nanobiotechnology_in_molecular_medicine.yml +306 -0
- data/lib/studium/yaml/curricula/individual/master_vector_based_strategies_in_life_sciences_molecular_medicine_and_biotechnology.yml +741 -0
- data/lib/studium/yaml/curricula/master/master_bioinformatik_066875.yml +75 -0
- data/lib/studium/yaml/curricula/master/master_biologie_molekulare_mikrobiologie_mikrobielle_oekologie_und_immunbiologie_066830.yml +78 -0
- data/lib/studium/yaml/curricula/master/master_biologische_chemie_066863.yml +66 -0
- data/lib/studium/yaml/curricula/master/master_dummy_curriculum.yml +197 -0
- data/lib/studium/yaml/curricula/master/master_genetik_und_entwicklungsbiologie_066877.yml +89 -0
- data/lib/studium/yaml/curricula/master/master_lmbt_066418.yml +112 -0
- data/lib/studium/yaml/curricula/master/master_molecular_biology_066865.yml +72 -0
- data/lib/studium/yaml/curricula/master/master_molekulare_biologie_066834.yml +151 -0
- data/lib/studium/yaml/curricula/master/master_pharmazie_066605.yml +176 -0
- data/lib/studium/yaml/curricula/master/master_technische_chemie_066490.yml +123 -0
- data/lib/studium/yaml/curricula/outdated/master_bioinformatics_and_molecular_biotechnology_including_aspects_from_molecular_medicine.yml +438 -0
- data/lib/studium/yaml/curricula/outdated/master_food_science_and_plant_biotechnology.yml +31 -0
- data/lib/studium/yaml/curricula.yml +562 -0
- data/lib/studium/yaml/daily_questions_solved/daily_questions_solved.yml +1849 -0
- data/lib/studium/yaml/default_delay.yml +4 -0
- data/lib/studium/yaml/default_encoding.yml +1 -0
- data/lib/studium/yaml/directory_to_the_exam_topics.yml +0 -0
- data/lib/studium/yaml/editor.yml +1 -0
- data/lib/studium/yaml/exams/next_exams_to_do.md +9 -0
- data/lib/studium/yaml/file_for_exam_questions.yml +1 -0
- data/lib/studium/yaml/german/README.md +2 -0
- data/lib/studium/yaml/german/german_to_english_month_names.yml +16 -0
- data/lib/studium/yaml/grouped_themes/grouped_themes.yml +258 -0
- data/lib/studium/yaml/holidays/holidays.yml +201 -0
- data/lib/studium/yaml/important_exams.yml +274 -0
- data/lib/studium/yaml/inscription_dates_of_universities.yml +60 -0
- data/lib/studium/yaml/lecture_aliases.yml +138 -0
- data/lib/studium/yaml/lecture_information/lecture_information.yml +63818 -0
- data/lib/studium/yaml/log_dir.yml +1 -0
- data/lib/studium/yaml/main_topic/main_topic.yml +11 -0
- data/lib/studium/yaml/max_stats.yml +256 -0
- data/lib/studium/yaml/meta_themes +1 -0
- data/lib/studium/yaml/mitbelegung/README.md +4 -0
- data/lib/studium/yaml/mitbelegung/mitbelegung.yml +21 -0
- data/lib/studium/yaml/mitteilungsbl/303/244tter/mitteilungsbl/303/244tter.yml +363 -0
- data/lib/studium/yaml/n_total_questions.yml +1 -0
- data/lib/studium/yaml/rename_konsole_tab.yml +1 -0
- data/lib/studium/yaml/semester_planner/README.md +4 -0
- data/lib/studium/yaml/semester_planner/semester_planner.yml +189 -0
- data/lib/studium/yaml/show_topic.yml +1 -0
- data/lib/studium/yaml/statistics/lecture_information.yml +1 -0
- data/lib/studium/yaml/statistics/max_stats.yml +239 -0
- data/lib/studium/yaml/statistics/statistics.yml +77 -0
- data/lib/studium/yaml/week/01_monday.yml +25 -0
- data/lib/studium/yaml/week/02_tuesday.yml +68 -0
- data/lib/studium/yaml/week/03_wednesday.yml +63 -0
- data/lib/studium/yaml/week/04_thursday.yml +20 -0
- data/lib/studium/yaml/week/05_friday.yml +31 -0
- data/lib/studium/yaml/week/06_saturday.yml +16 -0
- data/lib/studium/yaml/week/07_sunday.yml +0 -0
- data/lib/studium/yaml/week/README.md +10 -0
- data/lib/studium.rb +5 -0
- data/studium.gemspec +82 -0
- data/test/testing_colourized_question_and_answer.rb +18 -0
- data/test/testing_studium.rb +244 -0
- data/test/testing_studium_base_class.rb +31 -0
- data/test/testing_the_file_lecture_information.rb +18 -0
- data/test/testing_time_component.rb +29 -0
- metadata +1101 -0
@@ -0,0 +1,3229 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === Studium::Base
|
6
|
+
#
|
7
|
+
# This is the base class for other classes that are part of the Studium
|
8
|
+
# namespace.
|
9
|
+
#
|
10
|
+
# Not every class needs it though, so it is recommended to only make use
|
11
|
+
# of it if you need some "commonly shared functionality".
|
12
|
+
#
|
13
|
+
# Classes that belong to the Studium::Exams namespace should subclass
|
14
|
+
# from this class here as well.
|
15
|
+
# =========================================================================== #
|
16
|
+
# To require this base class, do:
|
17
|
+
#
|
18
|
+
# require 'studium/exams/base.rb'
|
19
|
+
#
|
20
|
+
# Then, to subclass from it, do:
|
21
|
+
#
|
22
|
+
# < Studium::Base
|
23
|
+
#
|
24
|
+
# In a shorter variant combining the two lines above, do this:
|
25
|
+
#
|
26
|
+
# require 'studium/base/base.rb'; < ::Studium::Base
|
27
|
+
#
|
28
|
+
# =========================================================================== #
|
29
|
+
require 'studium/base/prototype/prototype.rb'
|
30
|
+
|
31
|
+
module Studium
|
32
|
+
|
33
|
+
class Base # === Studium::Base
|
34
|
+
|
35
|
+
begin # Try to pull in code from the colours gem.
|
36
|
+
require 'colours/toplevel_methods/misc.rb'
|
37
|
+
rescue LoadError; end
|
38
|
+
|
39
|
+
begin
|
40
|
+
require 'opn'
|
41
|
+
rescue LoadError; end
|
42
|
+
|
43
|
+
begin
|
44
|
+
require 'roebe/requires/require_kde_konsole.rb'
|
45
|
+
rescue LoadError; end
|
46
|
+
|
47
|
+
begin
|
48
|
+
require 'open/in_browser/in_browser.rb'
|
49
|
+
rescue LoadError; end
|
50
|
+
|
51
|
+
# require 'studium/base/encoding.rb' # This also pulls in studium/encoding/encoding.rb
|
52
|
+
# ========================================================================= #
|
53
|
+
# We must support different encodings, so pull in the important files next.
|
54
|
+
# ========================================================================= #
|
55
|
+
require 'studium/requires/require_encoding.rb'
|
56
|
+
require 'studium/requires/require_the_studium_constants.rb'
|
57
|
+
require 'studium/logging/html_log_directory.rb'
|
58
|
+
require 'studium/logging/log_directory.rb'
|
59
|
+
|
60
|
+
# ========================================================================= #
|
61
|
+
# Add the necessary (and important) toplevel_methods next:
|
62
|
+
# ========================================================================= #
|
63
|
+
require 'studium/toplevel_methods/available_topics.rb'
|
64
|
+
require 'studium/toplevel_methods/curriculum_related_code.rb'
|
65
|
+
require 'studium/toplevel_methods/does_this_course_require_mandatory_presence.rb'
|
66
|
+
require 'studium/toplevel_methods/e.rb'
|
67
|
+
require 'studium/toplevel_methods/editor.rb'
|
68
|
+
require 'studium/toplevel_methods/esystem.rb'
|
69
|
+
require 'studium/toplevel_methods/filter_away_invalid_questions.rb'
|
70
|
+
require 'studium/toplevel_methods/find_exam_topic_and_exam_title.rb'
|
71
|
+
require 'studium/toplevel_methods/is_on_roebe.rb'
|
72
|
+
require 'studium/toplevel_methods/main_dataset.rb'
|
73
|
+
require 'studium/toplevel_methods/methods_related_to_files_and_directories.rb'
|
74
|
+
require 'studium/toplevel_methods/misc.rb'
|
75
|
+
require 'studium/toplevel_methods/regexes.rb'
|
76
|
+
require 'studium/toplevel_methods/remove_tags.rb'
|
77
|
+
require 'studium/toplevel_methods/report.rb'
|
78
|
+
require 'studium/toplevel_methods/return_all_exams_on_this_day.rb'
|
79
|
+
require 'studium/toplevel_methods/return_dataset_for_this_exam_topic.rb'
|
80
|
+
require 'studium/toplevel_methods/return_ects_from_this_lecture_stored_in_the_file_lecture_information.rb'
|
81
|
+
require 'studium/toplevel_methods/return_lva_number_of_this_lecture.rb'
|
82
|
+
require 'studium/toplevel_methods/return_sanitized_dataset_from_the_file_lecture_information.rb'
|
83
|
+
require 'studium/toplevel_methods/set_this_cd_alias_to.rb'
|
84
|
+
require 'studium/toplevel_methods/spacer.rb'
|
85
|
+
require 'studium/toplevel_methods/time.rb'
|
86
|
+
require 'studium/toplevel_methods/total_ects_points_passed.rb'
|
87
|
+
require 'studium/toplevel_methods/url.rb' # Has Studium.sanitize_url().
|
88
|
+
require 'studium/toplevel_methods/write_into_file_related_functionality.rb'
|
89
|
+
require 'studium/toplevel_methods/yes_or_no_ja_oder_nein.rb'
|
90
|
+
|
91
|
+
# ========================================================================= #
|
92
|
+
# === Base::N_CHARACTERS_PER_LINE
|
93
|
+
#
|
94
|
+
# If an answer exceeds the following threshold value, then we will chop
|
95
|
+
# some bits off of it. The reason why we have defined this here in
|
96
|
+
# class Base is because at the least two other classes that are
|
97
|
+
# part of the Exam namespace, require this.
|
98
|
+
# ========================================================================= #
|
99
|
+
N_CHARACTERS_PER_LINE = 78
|
100
|
+
|
101
|
+
# ========================================================================= #
|
102
|
+
# === Base::LEFT_PADDING
|
103
|
+
#
|
104
|
+
# The default padding (for showing the answer to an exam question) is
|
105
|
+
# 4 spaces since as of July 2020. In November 2020 2 spaces are now
|
106
|
+
# tried.
|
107
|
+
# ========================================================================= #
|
108
|
+
LEFT_PADDING = ' ' * 2 # 2 spaces for now.
|
109
|
+
|
110
|
+
# ========================================================================= #
|
111
|
+
# === COMMON_YEAR_DAYS_IN_MONTH
|
112
|
+
#
|
113
|
+
# This constant has the days per month, for the whole year.
|
114
|
+
#
|
115
|
+
# It will not honour leap years properly, though.
|
116
|
+
# ========================================================================= #
|
117
|
+
COMMON_YEAR_DAYS_IN_MONTH = [
|
118
|
+
nil,
|
119
|
+
31,
|
120
|
+
28,
|
121
|
+
31,
|
122
|
+
30,
|
123
|
+
31,
|
124
|
+
30,
|
125
|
+
31,
|
126
|
+
31,
|
127
|
+
30,
|
128
|
+
31,
|
129
|
+
30,
|
130
|
+
31
|
131
|
+
]
|
132
|
+
|
133
|
+
# ========================================================================= #
|
134
|
+
# === reset_the_internal_state
|
135
|
+
# ========================================================================= #
|
136
|
+
def reset_the_internal_state
|
137
|
+
# ======================================================================= #
|
138
|
+
# === @internal_hash[:no_connection_to_the_www]
|
139
|
+
#
|
140
|
+
# If true then we have no connection to the WWW.
|
141
|
+
# ======================================================================= #
|
142
|
+
@internal_hash[:no_connection_to_the_www] = false
|
143
|
+
end
|
144
|
+
|
145
|
+
# ========================================================================= #
|
146
|
+
# === www_connection_is_unavailable
|
147
|
+
# ========================================================================= #
|
148
|
+
def www_connection_is_unavailable
|
149
|
+
@internal_hash[:no_connection_to_the_www] = true
|
150
|
+
end; alias www_is_unavailable www_connection_is_unavailable # === www_is_unavailable
|
151
|
+
|
152
|
+
# ========================================================================= #
|
153
|
+
# === is_connected_to_the_www?
|
154
|
+
# ========================================================================= #
|
155
|
+
def is_connected_to_the_www?
|
156
|
+
!@internal_hash[:no_connection_to_the_www]
|
157
|
+
end
|
158
|
+
|
159
|
+
# ========================================================================= #
|
160
|
+
# === replace_bold_token_with_default_colour
|
161
|
+
#
|
162
|
+
# This method can be used to replace <b></b> with the corresponding
|
163
|
+
# colour code on the terminal.
|
164
|
+
# ========================================================================= #
|
165
|
+
def replace_bold_token_with_default_colour(
|
166
|
+
i, use_this_colour = :mediumseagreen
|
167
|
+
)
|
168
|
+
i.gsub(
|
169
|
+
/<b>(.+)<\/b>/,
|
170
|
+
::Colours.bold('\1')
|
171
|
+
)
|
172
|
+
end
|
173
|
+
|
174
|
+
# ========================================================================= #
|
175
|
+
# === spacer
|
176
|
+
# ========================================================================= #
|
177
|
+
def spacer
|
178
|
+
Studium.spacer
|
179
|
+
end
|
180
|
+
|
181
|
+
# ========================================================================= #
|
182
|
+
# === is_a_registered_curriculum?
|
183
|
+
#
|
184
|
+
# This calls code stored in the file
|
185
|
+
# /studium/toplevel_methods/curriculum_related_code.rb.
|
186
|
+
# ========================================================================= #
|
187
|
+
def is_a_registered_curriculum?(i)
|
188
|
+
return Studium.is_a_registered_curriculum?(i)
|
189
|
+
end
|
190
|
+
|
191
|
+
# ========================================================================= #
|
192
|
+
# === html_log_dir?
|
193
|
+
# ========================================================================= #
|
194
|
+
def html_log_directory?
|
195
|
+
Studium.html_log_directory?
|
196
|
+
end; alias html_log_dir? html_log_directory? # === html_log_dir?
|
197
|
+
|
198
|
+
# ========================================================================= #
|
199
|
+
# === opne
|
200
|
+
# ========================================================================= #
|
201
|
+
def opne(i)
|
202
|
+
opnn; e i
|
203
|
+
end
|
204
|
+
|
205
|
+
# ========================================================================= #
|
206
|
+
# === be_verbose?
|
207
|
+
# ========================================================================= #
|
208
|
+
def be_verbose?
|
209
|
+
@internal_hash[:be_verbose]
|
210
|
+
end
|
211
|
+
|
212
|
+
# ========================================================================= #
|
213
|
+
# === do_not_be_verbose
|
214
|
+
# ========================================================================= #
|
215
|
+
def do_not_be_verbose
|
216
|
+
@internal_hash[:be_verbose] = false
|
217
|
+
end; alias set_be_quiet do_not_be_verbose # === set_be_quiet
|
218
|
+
|
219
|
+
# ========================================================================= #
|
220
|
+
# === set_be_verbose
|
221
|
+
# ========================================================================= #
|
222
|
+
def set_be_verbose
|
223
|
+
@internal_hash[:be_verbose] = true
|
224
|
+
end; alias be_verbose set_be_verbose # === be_verbose
|
225
|
+
|
226
|
+
# ========================================================================= #
|
227
|
+
# === move_file
|
228
|
+
# ========================================================================= #
|
229
|
+
def move_file(this_file, target)
|
230
|
+
FileUtils.mv(this_file, target)
|
231
|
+
end
|
232
|
+
|
233
|
+
# ========================================================================= #
|
234
|
+
# === has_this_exam_topic_been_solved?
|
235
|
+
# ========================================================================= #
|
236
|
+
def has_this_exam_topic_been_solved?(i)
|
237
|
+
(Studium.return_n_percent_solved_from_this_topic(i).to_i == 100)
|
238
|
+
end
|
239
|
+
|
240
|
+
# ========================================================================= #
|
241
|
+
# === cpruby
|
242
|
+
# ========================================================================= #
|
243
|
+
def cpruby
|
244
|
+
base_dir = ENV['USERS']
|
245
|
+
base_dir = '/home' if base_dir.nil?
|
246
|
+
path_to_setup_rb_file =
|
247
|
+
"#{RUBY_SRC_DIR}roebe/lib/roebe/setup/setup.rb"
|
248
|
+
copy(path_to_setup_rb_file, '.')
|
249
|
+
end
|
250
|
+
|
251
|
+
# ========================================================================= #
|
252
|
+
# === delete_file
|
253
|
+
# ========================================================================= #
|
254
|
+
def delete_file(i)
|
255
|
+
File.delete(i) if File.exist? i
|
256
|
+
end
|
257
|
+
|
258
|
+
# ========================================================================= #
|
259
|
+
# === filter_away_invalid_questions
|
260
|
+
#
|
261
|
+
# This method will remove entries that begin with '#' and empty entries.
|
262
|
+
# ========================================================================= #
|
263
|
+
def filter_away_invalid_questions(i)
|
264
|
+
Studium.filter_away_invalid_questions(i)
|
265
|
+
end
|
266
|
+
|
267
|
+
# ========================================================================= #
|
268
|
+
# === read_in_exam_dataset_from_this_file
|
269
|
+
#
|
270
|
+
# This is the method that will read from an existing file. If a symbol
|
271
|
+
# is given then we will expand this to the default exam-topic directory.
|
272
|
+
# ========================================================================= #
|
273
|
+
def read_in_exam_dataset_from_this_file(
|
274
|
+
this_file
|
275
|
+
)
|
276
|
+
if this_file.is_a? Symbol
|
277
|
+
this_file = "#{exam_topic_directory?}#{this_file}"
|
278
|
+
end
|
279
|
+
if File.exist? this_file
|
280
|
+
dataset = readlines_via_default_encoding(this_file)
|
281
|
+
dataset = filter_away_invalid_questions(dataset)
|
282
|
+
return dataset
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
# ========================================================================= #
|
287
|
+
# === remove_internal_comments
|
288
|
+
# ========================================================================= #
|
289
|
+
def remove_internal_comments(i)
|
290
|
+
if i.is_a? Array
|
291
|
+
i.map {|line|
|
292
|
+
if line.include? '#'
|
293
|
+
line = line[0 .. (line.index('#') - 1)]
|
294
|
+
end
|
295
|
+
line.strip
|
296
|
+
}
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
# ========================================================================= #
|
301
|
+
# === return_all_numbers_from
|
302
|
+
#
|
303
|
+
# This method will return all numbers from the given input.
|
304
|
+
# ========================================================================= #
|
305
|
+
def return_all_numbers_from(i)
|
306
|
+
return_this = nil
|
307
|
+
if i.is_a? Array
|
308
|
+
return_this = i.select {|line|
|
309
|
+
line =~ /\d+/ # Any entry with a number will be returned.
|
310
|
+
}
|
311
|
+
end
|
312
|
+
return_this
|
313
|
+
end
|
314
|
+
|
315
|
+
# ========================================================================= #
|
316
|
+
# === return_all_steop_lectures
|
317
|
+
# ========================================================================= #
|
318
|
+
def return_all_steop_lectures
|
319
|
+
return_sanitized_dataset_from_the_file_lecture_information.select {|a, b|
|
320
|
+
is_a_steop_lecture = obtain(:steop, b)
|
321
|
+
is_a_steop_lecture
|
322
|
+
}
|
323
|
+
end
|
324
|
+
|
325
|
+
# ========================================================================= #
|
326
|
+
# === extract_dd_mm_yyyy
|
327
|
+
#
|
328
|
+
# This method can be used to extract the dd.mm.yyyy format from the given
|
329
|
+
# input at hand. It will discard everything else.
|
330
|
+
#
|
331
|
+
# So, for instance, if the input is "15.10.2018, 09:00-18:00" then
|
332
|
+
# this method will return only "15.10.2018".
|
333
|
+
# ========================================================================= #
|
334
|
+
def extract_dd_mm_yyyy(i)
|
335
|
+
i =~ /(\d{1,2}\.\d{1,2}\.\d{4})/ # This will also generate a match.
|
336
|
+
return $1.to_s.dup
|
337
|
+
end; alias extract_ddmmyyyy extract_dd_mm_yyyy # === extract_ddmmyyyy
|
338
|
+
|
339
|
+
# ========================================================================= #
|
340
|
+
# === return_month_fitting_to_this_input
|
341
|
+
#
|
342
|
+
# This method will return a number.
|
343
|
+
# ========================================================================= #
|
344
|
+
def return_month_fitting_to_this_input(i)
|
345
|
+
i = i.capitalize
|
346
|
+
if MONTH_NAME_TO_MONTH_NUMBER.has_key? i
|
347
|
+
i = MONTH_NAME_TO_MONTH_NUMBER[i]
|
348
|
+
end
|
349
|
+
return i.to_i
|
350
|
+
end
|
351
|
+
|
352
|
+
# ========================================================================= #
|
353
|
+
# === remove_leading_weekday_names_from
|
354
|
+
#
|
355
|
+
# Chop away the leading weekday, e. g. "Monday", from the String at hand.
|
356
|
+
# ========================================================================= #
|
357
|
+
def remove_leading_weekday_names_from(i)
|
358
|
+
Studium.remove_leading_weekday_names_from(i)
|
359
|
+
end; alias remove_german_weekdays remove_leading_weekday_names_from # === remove_german_weekdays
|
360
|
+
alias remove_german_weekdays_from remove_leading_weekday_names_from # === remove_german_weekdays_from
|
361
|
+
alias remove_leading_weeknames remove_leading_weekday_names_from # === remove_leading_weeknames
|
362
|
+
alias remove_leading_weekdays remove_leading_weekday_names_from # === remove_leading_weekdays
|
363
|
+
alias remove_workday_from_this_input remove_leading_weekday_names_from # === remove_workday_from_this_input
|
364
|
+
alias remove_german_days remove_leading_weekday_names_from # === remove_german_days
|
365
|
+
|
366
|
+
# ========================================================================= #
|
367
|
+
# === is_on_roebe?
|
368
|
+
# ========================================================================= #
|
369
|
+
def is_on_roebe?
|
370
|
+
Studium.is_on_roebe?
|
371
|
+
end; alias is_roebe? is_on_roebe? # === is_roebe?
|
372
|
+
alias on_roebe? is_on_roebe? # === on_roebe?
|
373
|
+
|
374
|
+
# ========================================================================= #
|
375
|
+
# === weekdays?
|
376
|
+
#
|
377
|
+
# This method will return all weekdays, as Array, including german
|
378
|
+
# and english names for these weekdays.
|
379
|
+
# ========================================================================= #
|
380
|
+
def weekdays?
|
381
|
+
(
|
382
|
+
ARRAY_GERMAN_WEEKDAYS+
|
383
|
+
HASH_SHORT_TO_LONG_WEEKDAYS.values
|
384
|
+
).flatten
|
385
|
+
end
|
386
|
+
|
387
|
+
# ========================================================================= #
|
388
|
+
# === german_weekdays?
|
389
|
+
# ========================================================================= #
|
390
|
+
def german_weekdays?
|
391
|
+
ARRAY_GERMAN_WEEKDAYS
|
392
|
+
end
|
393
|
+
|
394
|
+
# ========================================================================= #
|
395
|
+
# === try_to_require_the_rcfiles
|
396
|
+
# ========================================================================= #
|
397
|
+
def try_to_require_the_rcfiles
|
398
|
+
begin
|
399
|
+
require 'rcfiles'
|
400
|
+
rescue LoadError; end
|
401
|
+
end
|
402
|
+
|
403
|
+
# ========================================================================= #
|
404
|
+
# === copy (copy tag)
|
405
|
+
# ========================================================================= #
|
406
|
+
def copy(from, to)
|
407
|
+
if from.is_a? Array
|
408
|
+
from.each {|entry|
|
409
|
+
copy(entry, to)
|
410
|
+
}
|
411
|
+
else
|
412
|
+
FileUtils.copy(from, to)
|
413
|
+
end
|
414
|
+
end; alias copy_file copy # === copy_file
|
415
|
+
|
416
|
+
# ========================================================================= #
|
417
|
+
# === set_xorg_buffer
|
418
|
+
# ========================================================================= #
|
419
|
+
def set_xorg_buffer(i)
|
420
|
+
begin
|
421
|
+
require 'xorg_buffer' unless Object.const_defined?(:XorgBuffer)
|
422
|
+
XorgBuffer.set_buffer(i)
|
423
|
+
rescue LoadError
|
424
|
+
if is_on_roebe?
|
425
|
+
e 'XorgBuffer is not available - can not set the buffer.'
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
430
|
+
# ========================================================================= #
|
431
|
+
# === lectures_from_the_individual_vektor_curricula
|
432
|
+
#
|
433
|
+
# This method is a convenience method, returning all the lectures that
|
434
|
+
# belong to the individual bachelor+master vektor-curriculum
|
435
|
+
# ========================================================================= #
|
436
|
+
def lectures_from_the_individual_vektor_curricula
|
437
|
+
(
|
438
|
+
obtain_lectures_from_this_curriculum(:bachelor_vektor)+
|
439
|
+
obtain_lectures_from_this_curriculum(:master_vektor)
|
440
|
+
).flatten
|
441
|
+
end
|
442
|
+
|
443
|
+
# ========================================================================= #
|
444
|
+
# === open_in_editor
|
445
|
+
# ========================================================================= #
|
446
|
+
def open_in_editor(i)
|
447
|
+
Studium.open_in_editor(i)
|
448
|
+
end
|
449
|
+
|
450
|
+
# ========================================================================= #
|
451
|
+
# === editor?
|
452
|
+
# ========================================================================= #
|
453
|
+
def editor?
|
454
|
+
Studium.editor?
|
455
|
+
end
|
456
|
+
|
457
|
+
# ========================================================================= #
|
458
|
+
# === encoding?
|
459
|
+
#
|
460
|
+
# This method will return the main encoding in use, by "pointing" towards
|
461
|
+
# the constant that keeps track of this.
|
462
|
+
# ========================================================================= #
|
463
|
+
def encoding?
|
464
|
+
::Studium.main_encoding?
|
465
|
+
end; alias main_encoding? encoding? # === main_encoding?
|
466
|
+
alias main_encoding_to_use? encoding? # === main_encoding_to_use?
|
467
|
+
alias use_this_encoding? encoding? # === use_this_encoding?
|
468
|
+
alias encoding_to_use? encoding? # === encoding_to_use?
|
469
|
+
|
470
|
+
# ========================================================================= #
|
471
|
+
# === exit_program (exit tag)
|
472
|
+
#
|
473
|
+
# Use this method to exit from the program. It is a general "exit-operation"
|
474
|
+
# for classes in the Studium project. The reason as to why we don't just
|
475
|
+
# simply use exit() is so that we
|
476
|
+
# ========================================================================= #
|
477
|
+
def exit_program(
|
478
|
+
make_newline = :no_newline
|
479
|
+
)
|
480
|
+
case make_newline
|
481
|
+
# ======================================================================= #
|
482
|
+
# === :no_newline
|
483
|
+
# ======================================================================= #
|
484
|
+
when :no_newline
|
485
|
+
make_newline = false
|
486
|
+
end
|
487
|
+
e(N) if make_newline
|
488
|
+
exit # Exit here.
|
489
|
+
end
|
490
|
+
|
491
|
+
# ========================================================================= #
|
492
|
+
# === turn_this_array_into_the_full_dataset
|
493
|
+
#
|
494
|
+
# This method accepts an Array of lectures that will be replaced with
|
495
|
+
# a full dataset.
|
496
|
+
# ========================================================================= #
|
497
|
+
def turn_this_array_into_the_full_dataset(
|
498
|
+
i, use_this_dataset
|
499
|
+
)
|
500
|
+
hash = {}
|
501
|
+
i.flatten.each {|name_of_the_lecture|
|
502
|
+
pointer = use_this_dataset[name_of_the_lecture]
|
503
|
+
hash[name_of_the_lecture] = pointer
|
504
|
+
}
|
505
|
+
hash
|
506
|
+
end
|
507
|
+
|
508
|
+
# ========================================================================= #
|
509
|
+
# === no_ext_name
|
510
|
+
#
|
511
|
+
# This method will return the name of the file (or rather the
|
512
|
+
# input given to this method) without extension.
|
513
|
+
# ========================================================================= #
|
514
|
+
def no_ext_name(i)
|
515
|
+
i.sub(/#{File.extname(i)}$/,'')
|
516
|
+
end
|
517
|
+
|
518
|
+
# ========================================================================= #
|
519
|
+
# === load_yaml_dataset
|
520
|
+
#
|
521
|
+
# This method should ideally be used whenever a .yml file is to be
|
522
|
+
# loaded.
|
523
|
+
#
|
524
|
+
# The second argument can be used to rescue missing or erroneous
|
525
|
+
# yaml files.
|
526
|
+
#
|
527
|
+
# Invocation example for this is:
|
528
|
+
#
|
529
|
+
# load_yaml_dataset(:rescue)
|
530
|
+
#
|
531
|
+
# ========================================================================= #
|
532
|
+
def load_yaml_dataset(
|
533
|
+
i,
|
534
|
+
do_rescue = false
|
535
|
+
)
|
536
|
+
case do_rescue
|
537
|
+
# ======================================================================= #
|
538
|
+
# === :rescue
|
539
|
+
# ======================================================================= #
|
540
|
+
when :rescue
|
541
|
+
do_rescue = true
|
542
|
+
end
|
543
|
+
if do_rescue
|
544
|
+
begin
|
545
|
+
YAML.load_file(i)
|
546
|
+
rescue LoadError, ArgumentError; end
|
547
|
+
else
|
548
|
+
YAML.load_file(i)
|
549
|
+
end
|
550
|
+
end
|
551
|
+
|
552
|
+
# ========================================================================= #
|
553
|
+
# === enable_debug
|
554
|
+
# ========================================================================= #
|
555
|
+
def enable_debug
|
556
|
+
@internal_hash[:debug] = true
|
557
|
+
end; alias do_debug enable_debug # === do_debug
|
558
|
+
|
559
|
+
# ========================================================================= #
|
560
|
+
# === be_silent
|
561
|
+
# ========================================================================= #
|
562
|
+
def be_silent
|
563
|
+
@internal_hash[:be_verbose] = false
|
564
|
+
end; alias be_quiet be_silent # === be_quiet
|
565
|
+
|
566
|
+
# ========================================================================= #
|
567
|
+
# === is_a_weekday?
|
568
|
+
#
|
569
|
+
# This method will return true if the input is a String that represents
|
570
|
+
# a weekday, such as "Monday". Otherwise, false will be returned.
|
571
|
+
#
|
572
|
+
# Both german and english variants are allowed here.
|
573
|
+
# ========================================================================= #
|
574
|
+
def is_a_weekday?(i = 'Montag')
|
575
|
+
result = false
|
576
|
+
if ARRAY_GERMAN_WEEKDAYS.include? i
|
577
|
+
result = true
|
578
|
+
elsif ARRAY_ENGLISH_WEEKDAYS.include? i
|
579
|
+
result = true
|
580
|
+
end
|
581
|
+
return result
|
582
|
+
end
|
583
|
+
|
584
|
+
# ========================================================================= #
|
585
|
+
# === lectures_from_indi1
|
586
|
+
# ========================================================================= #
|
587
|
+
def lectures_from_indi1
|
588
|
+
obtain_lectures_from_this_curriculum(:indi1)
|
589
|
+
end
|
590
|
+
|
591
|
+
# ========================================================================= #
|
592
|
+
# === lectures_from_indi2
|
593
|
+
# ========================================================================= #
|
594
|
+
def lectures_from_indi2
|
595
|
+
obtain_lectures_from_this_curriculum(:indi2)
|
596
|
+
end
|
597
|
+
|
598
|
+
# ========================================================================= #
|
599
|
+
# === lectures_from_indi3
|
600
|
+
# ========================================================================= #
|
601
|
+
def lectures_from_indi3
|
602
|
+
obtain_lectures_from_this_curriculum(:indi3)
|
603
|
+
end
|
604
|
+
|
605
|
+
# ========================================================================= #
|
606
|
+
# === lectures_from_indi4
|
607
|
+
# ========================================================================= #
|
608
|
+
def lectures_from_indi4
|
609
|
+
obtain_lectures_from_this_curriculum(:indi4)
|
610
|
+
end
|
611
|
+
|
612
|
+
# ========================================================================= #
|
613
|
+
# === return_random_curriculum
|
614
|
+
# ========================================================================= #
|
615
|
+
def return_random_curriculum
|
616
|
+
::Studium.return_random_curriculum
|
617
|
+
end
|
618
|
+
|
619
|
+
# ========================================================================= #
|
620
|
+
# === lectures_from_the_bachelor_genetik_curriculum
|
621
|
+
# ========================================================================= #
|
622
|
+
def lectures_from_the_bachelor_genetik_curriculum
|
623
|
+
obtain_lectures_from_this_curriculum(:bachelor_genetik_curriculum)
|
624
|
+
end
|
625
|
+
|
626
|
+
# ========================================================================= #
|
627
|
+
# === return_lectures_from_bachelor_vektor_curriculum
|
628
|
+
# ========================================================================= #
|
629
|
+
def return_lectures_from_bachelor_vektor_curriculum
|
630
|
+
obtain_lectures_from_this_curriculum(:bachelor_vektor)
|
631
|
+
end
|
632
|
+
|
633
|
+
# ========================================================================= #
|
634
|
+
# === convert_this_array_of_lectures_into_the_full_dataset
|
635
|
+
#
|
636
|
+
# The purpose of this method is to turn an Array that holds Strings
|
637
|
+
# such as "941111 Genetische Ressourcen von Nutzpflanzen" into the
|
638
|
+
# corresponding dataset.
|
639
|
+
#
|
640
|
+
# This method will return a Hash if everything went fine.
|
641
|
+
# ========================================================================= #
|
642
|
+
def convert_this_array_of_lectures_into_the_full_dataset(i)
|
643
|
+
if i.is_a? Array
|
644
|
+
if Studium.main_dataset?.nil?
|
645
|
+
Studium.initialize_main_dataset
|
646
|
+
end
|
647
|
+
_ = Studium.main_dataset?
|
648
|
+
hash = {}
|
649
|
+
i.map {|course_id_and_course_name|
|
650
|
+
if _.has_key?(course_id_and_course_name)
|
651
|
+
hash[course_id_and_course_name] = _[course_id_and_course_name]
|
652
|
+
end
|
653
|
+
}
|
654
|
+
hash
|
655
|
+
else
|
656
|
+
raise 'This method only accepts an Array as input.'
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
# ========================================================================= #
|
661
|
+
# === return_this_line_has_n_characters_as_html_colour_tags
|
662
|
+
# ========================================================================= #
|
663
|
+
def return_this_line_has_n_characters_as_html_colour_tags(i)
|
664
|
+
i.scan(REGEX_FOR_OPENING_AND_CLOSING_COLOUR_TAGS).map {|entry|
|
665
|
+
entry.size
|
666
|
+
}.sum
|
667
|
+
end
|
668
|
+
|
669
|
+
# ========================================================================= #
|
670
|
+
# === file_read_with_proper_encoding
|
671
|
+
# ========================================================================= #
|
672
|
+
def file_read_with_proper_encoding(this_file)
|
673
|
+
Studium.file_read_with_proper_encoding(this_file)
|
674
|
+
end
|
675
|
+
|
676
|
+
# ========================================================================= #
|
677
|
+
# === create_file
|
678
|
+
# ========================================================================= #
|
679
|
+
def create_file(i)
|
680
|
+
FileUtils.touch(i)
|
681
|
+
end; alias touch create_file # === touch
|
682
|
+
|
683
|
+
# ========================================================================= #
|
684
|
+
# === return_n_questions_were_answered_for_this_topic
|
685
|
+
# ========================================================================= #
|
686
|
+
def return_n_questions_were_answered_for_this_topic(i)
|
687
|
+
Studium::Exams.return_n_questions_were_answered_for_this_topic(i)
|
688
|
+
end
|
689
|
+
|
690
|
+
# ========================================================================= #
|
691
|
+
# === create_directory
|
692
|
+
# ========================================================================= #
|
693
|
+
def create_directory(i)
|
694
|
+
FileUtils.mkdir_p(i)
|
695
|
+
end; alias mkdir create_directory # === mkdir
|
696
|
+
|
697
|
+
# ========================================================================= #
|
698
|
+
# === change_directory
|
699
|
+
# ========================================================================= #
|
700
|
+
def change_directory(
|
701
|
+
i = Dir.pwd
|
702
|
+
)
|
703
|
+
FileUtils.chdir(i)
|
704
|
+
end; alias cd change_directory # === cd
|
705
|
+
|
706
|
+
# ========================================================================= #
|
707
|
+
# === return_passed_courses
|
708
|
+
#
|
709
|
+
# This method will quickly return all passed courses.
|
710
|
+
# ========================================================================= #
|
711
|
+
def return_passed_courses
|
712
|
+
return_dataset_from_file_lecture_information.select {|key, hash|
|
713
|
+
hash.has_key?(:already_solved) and
|
714
|
+
(hash[:already_solved] == true)
|
715
|
+
}
|
716
|
+
end
|
717
|
+
|
718
|
+
# ========================================================================= #
|
719
|
+
# === return_ects_points_from_these_lectures
|
720
|
+
#
|
721
|
+
# Input to this method should be a Hash containing our lectures.
|
722
|
+
#
|
723
|
+
# An example for this is shown next:
|
724
|
+
#
|
725
|
+
# {"051010"=>"Programmierung 1",
|
726
|
+
# "051110"=>"Mathematische Grundlagen der Informatik 1"}
|
727
|
+
#
|
728
|
+
# ========================================================================= #
|
729
|
+
def return_ects_points_from_these_lectures(hash)
|
730
|
+
n_ects_points = 0 # Keep track of the amount of ECTS points here.
|
731
|
+
hash.each_pair {|lecture_id, name_of_the_lecture|
|
732
|
+
# lecture_id = ensure_main_encoding(lecture_id)
|
733
|
+
# name_of_the_lecture = ensure_main_encoding(name_of_the_lecture)
|
734
|
+
name_of_the_lecture.squeeze!(' ')
|
735
|
+
points = Studium.return_ects_from_this_lecture_stored_in_the_file_lecture_information(
|
736
|
+
name_of_the_lecture, lecture_id
|
737
|
+
)
|
738
|
+
n_ects_points += points
|
739
|
+
}
|
740
|
+
return n_ects_points
|
741
|
+
end
|
742
|
+
|
743
|
+
# ========================================================================= #
|
744
|
+
# === select_lectures_with_this_key
|
745
|
+
#
|
746
|
+
# This method allows us to select only entries with a particular
|
747
|
+
# key. The key has to be passed to the method and - for now - has
|
748
|
+
# to be exactly the same as the key (e. g. string for strings
|
749
|
+
# and symbols for symbols; no automatic conversions for now).
|
750
|
+
#
|
751
|
+
# The advantage of this method is that it will simplify a lot of
|
752
|
+
# code; all code that requires us to select only specific
|
753
|
+
# lectures.
|
754
|
+
#
|
755
|
+
# Usage examples:
|
756
|
+
#
|
757
|
+
# .select_lectures_with_this_key(:exam_registration_at)
|
758
|
+
# .select_lectures_with_this_key(:already_solved)
|
759
|
+
#
|
760
|
+
# ========================================================================= #
|
761
|
+
def select_lectures_with_this_key(
|
762
|
+
searching_for_this_key
|
763
|
+
)
|
764
|
+
dataset = return_sanitized_dataset_from_the_file_lecture_information
|
765
|
+
dataset.select! {|name_of_the_lecture, inner_hash|
|
766
|
+
inner_hash.has_key? searching_for_this_key
|
767
|
+
} if dataset # <- Must check here, since there may be a nil.
|
768
|
+
return dataset
|
769
|
+
end
|
770
|
+
|
771
|
+
# ========================================================================= #
|
772
|
+
# === konsole_support?
|
773
|
+
# ========================================================================= #
|
774
|
+
def konsole_support?
|
775
|
+
true
|
776
|
+
end
|
777
|
+
|
778
|
+
# ========================================================================= #
|
779
|
+
# === rename_kde_konsole_tab
|
780
|
+
# ========================================================================= #
|
781
|
+
def rename_kde_konsole_tab(
|
782
|
+
title = '.'
|
783
|
+
)
|
784
|
+
if Object.const_defined?(:Roebe) and
|
785
|
+
Roebe.respond_to?(:rename_konsole_title_to)
|
786
|
+
Roebe.rename_konsole_title_to(title, :be_quiet)
|
787
|
+
end
|
788
|
+
end
|
789
|
+
|
790
|
+
# ========================================================================= #
|
791
|
+
# === last_file?
|
792
|
+
# ========================================================================= #
|
793
|
+
def last_file?
|
794
|
+
_ = Studium.file_for_exam_questions
|
795
|
+
_ = load_yaml_dataset(_).chomp
|
796
|
+
# ======================================================================= #
|
797
|
+
# If we are on roebe then we will use another path.
|
798
|
+
# ======================================================================= #
|
799
|
+
if is_on_roebe?
|
800
|
+
_ = Studium::MY_EXAM_TOPICS+File.basename(_)
|
801
|
+
end
|
802
|
+
return _
|
803
|
+
end
|
804
|
+
|
805
|
+
# ========================================================================= #
|
806
|
+
# === return_sanitized_dataset_from_the_file_lecture_information
|
807
|
+
#
|
808
|
+
# This method will return the dataset stored in the file
|
809
|
+
# 'lecture_information.yml'.
|
810
|
+
# ========================================================================= #
|
811
|
+
def return_sanitized_dataset_from_the_file_lecture_information
|
812
|
+
Studium.return_sanitized_dataset_from_the_file_lecture_information
|
813
|
+
end; alias return_dataset_from_the_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_dataset_from_the_file_lecture_information
|
814
|
+
alias return_dataset_from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_dataset_from_file_lecture_information
|
815
|
+
alias lecture_information_dataset return_sanitized_dataset_from_the_file_lecture_information # === lecture_information_dataset
|
816
|
+
alias lecture_information return_sanitized_dataset_from_the_file_lecture_information # === lecture_information_dataset
|
817
|
+
alias dataset_from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === dataset_from_file_lecture_information
|
818
|
+
alias dataset_from_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === dataset_from_lecture_information
|
819
|
+
alias dataset_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === dataset_lecture_information
|
820
|
+
alias return_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_lecture_information
|
821
|
+
alias return_data_from_the_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_data_from_the_file_lecture_information
|
822
|
+
alias return_all_lectures return_sanitized_dataset_from_the_file_lecture_information # === return_all_lectures
|
823
|
+
alias all_lectures? return_sanitized_dataset_from_the_file_lecture_information # === all_lectures?
|
824
|
+
alias return_lectures_from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_lectures_from_file_lecture_information
|
825
|
+
alias dataset_from_the_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === dataset_from_the_file_lecture_information
|
826
|
+
alias return_sanitized_dataset_from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_sanitized_dataset_from_file_lecture_information
|
827
|
+
alias return_dataset_from_the_lectures return_sanitized_dataset_from_the_file_lecture_information # === return_dataset_from_the_lectures
|
828
|
+
alias return_sanitized_dataset return_sanitized_dataset_from_the_file_lecture_information # === return_sanitized_dataset
|
829
|
+
alias return_all_lectures_from_the_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_all_lectures_from_the_file_lecture_information
|
830
|
+
alias return_dataset_from_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_dataset_from_lecture_information
|
831
|
+
alias from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === from_file_lecture_information
|
832
|
+
alias sanitized_dataset_from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === sanitized_dataset_from_file_lecture_information
|
833
|
+
alias dataset_from_the_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === dataset_from_the_file_lecture_information
|
834
|
+
|
835
|
+
# ========================================================================= #
|
836
|
+
# === obtain (obtain tag)
|
837
|
+
#
|
838
|
+
# This method will attempt to return the entry point of our main hash.
|
839
|
+
#
|
840
|
+
# It is optimized towards the dataset stored in the file
|
841
|
+
# 'lecture_information.yml'.
|
842
|
+
#
|
843
|
+
# Typical usage example:
|
844
|
+
#
|
845
|
+
# curricula = obtain(:curricula, pointer_to_the_lecture_dataset)
|
846
|
+
#
|
847
|
+
# ========================================================================= #
|
848
|
+
def obtain(
|
849
|
+
this_key, hash, be_verbose = true
|
850
|
+
)
|
851
|
+
if block_given?
|
852
|
+
yielded = yield
|
853
|
+
case yielded
|
854
|
+
# ===================================================================== #
|
855
|
+
# === :be_quiet
|
856
|
+
# ===================================================================== #
|
857
|
+
when :be_quiet
|
858
|
+
be_verbose = false
|
859
|
+
end
|
860
|
+
end
|
861
|
+
case be_verbose
|
862
|
+
when :be_quiet,
|
863
|
+
:be_silent
|
864
|
+
be_verbose = false
|
865
|
+
end
|
866
|
+
# ======================================================================= #
|
867
|
+
# The following case menu will make use of some common popular aliases
|
868
|
+
# or typos.
|
869
|
+
# ======================================================================= #
|
870
|
+
case this_key
|
871
|
+
# ======================================================================= #
|
872
|
+
# === :passed_when
|
873
|
+
# ======================================================================= #
|
874
|
+
when :passed_when,
|
875
|
+
:solved_at
|
876
|
+
this_key = :already_solved_at
|
877
|
+
# ======================================================================= #
|
878
|
+
# === :passed_successfully
|
879
|
+
# ======================================================================= #
|
880
|
+
when :passed_successfully
|
881
|
+
this_key = :already_solved
|
882
|
+
# ======================================================================= #
|
883
|
+
# === :steop
|
884
|
+
# ======================================================================= #
|
885
|
+
when :steop,
|
886
|
+
'steop'
|
887
|
+
this_key = :is_a_steop_lecture
|
888
|
+
# ======================================================================= #
|
889
|
+
# === :curricula_entries
|
890
|
+
# ======================================================================= #
|
891
|
+
when :curricula_entries,
|
892
|
+
:curricula,
|
893
|
+
'curricula'
|
894
|
+
this_key = 'curricula'
|
895
|
+
# ======================================================================= #
|
896
|
+
# === :english_description
|
897
|
+
# ======================================================================= #
|
898
|
+
when :english_description
|
899
|
+
this_key = :description_in_english
|
900
|
+
# ======================================================================= #
|
901
|
+
# === :german_description
|
902
|
+
# ======================================================================= #
|
903
|
+
when :german_description
|
904
|
+
this_key = :description_in_german
|
905
|
+
# ======================================================================= #
|
906
|
+
# === :this_university
|
907
|
+
# ======================================================================= #
|
908
|
+
when :this_university,
|
909
|
+
:university
|
910
|
+
this_key = :university
|
911
|
+
# ======================================================================= #
|
912
|
+
# === :n_ects
|
913
|
+
# ======================================================================= #
|
914
|
+
when :n_ects, :n_ects_points
|
915
|
+
this_key = :ects
|
916
|
+
# ======================================================================= #
|
917
|
+
# === :curricula_ids
|
918
|
+
# ======================================================================= #
|
919
|
+
when :curricula_ids,
|
920
|
+
:curriculum_id
|
921
|
+
this_key = 'curricula'
|
922
|
+
# ======================================================================= #
|
923
|
+
# === :lecturers
|
924
|
+
# ======================================================================= #
|
925
|
+
when :lecturers
|
926
|
+
this_key = 'lecturers'
|
927
|
+
# ======================================================================= #
|
928
|
+
# === :semester
|
929
|
+
# ======================================================================= #
|
930
|
+
when 'homepage',
|
931
|
+
:remote_url
|
932
|
+
this_key = :homepage
|
933
|
+
# ======================================================================= #
|
934
|
+
# === :semester
|
935
|
+
# ======================================================================= #
|
936
|
+
when :semester, 'semester'
|
937
|
+
this_key = :semester
|
938
|
+
end
|
939
|
+
# ======================================================================= #
|
940
|
+
# Work on any other symbols given to us next.
|
941
|
+
# ======================================================================= #
|
942
|
+
if this_key.is_a? Symbol
|
943
|
+
if hash.has_key? this_key
|
944
|
+
# All is fine.
|
945
|
+
elsif hash.has_key? this_key.to_s
|
946
|
+
# Else use that String as key instead.
|
947
|
+
this_key = this_key.to_s
|
948
|
+
end
|
949
|
+
end
|
950
|
+
if hash.is_a? Symbol
|
951
|
+
e "Symbol called :#{slateblue(hash.to_s)}"
|
952
|
+
e swarn('This is not allowed - please correct this. '\
|
953
|
+
'(Read the next line in how to do so.)')
|
954
|
+
e swarn('This method requires (1) first the key, (2) then the Hash.')
|
955
|
+
exit
|
956
|
+
elsif hash.is_a?(Hash) and hash.has_key?(this_key)
|
957
|
+
hash[this_key] # Return this.
|
958
|
+
else
|
959
|
+
if be_verbose
|
960
|
+
case this_key
|
961
|
+
when :is_a_steop_lecture
|
962
|
+
# Exceptions - these keys ^^^ will NOT be shown.
|
963
|
+
else
|
964
|
+
e "In file #{sfile('base.rb')}, method: obtain() → No key found, "\
|
965
|
+
"called `#{this_key.to_s}` (class '#{this_key.class.to_s})"
|
966
|
+
e 'The hash was:'
|
967
|
+
e
|
968
|
+
pp hash
|
969
|
+
e
|
970
|
+
end
|
971
|
+
end
|
972
|
+
nil
|
973
|
+
end
|
974
|
+
end; alias obtain_this_value_from_hash obtain # === obtain_this_value_from_hash
|
975
|
+
alias obtain_from obtain # === obtain_from
|
976
|
+
|
977
|
+
# ========================================================================= #
|
978
|
+
# === colour_for_ects_points
|
979
|
+
# ========================================================================= #
|
980
|
+
def colour_for_ects_points(i = '')
|
981
|
+
::Studium.colour_for_ects_points(i)
|
982
|
+
end; alias colourize_ects colour_for_ects_points # === colourize_ects
|
983
|
+
alias colour_ects colour_for_ects_points # === colour_ects
|
984
|
+
|
985
|
+
# ========================================================================= #
|
986
|
+
# === return_opnn
|
987
|
+
# ========================================================================= #
|
988
|
+
def return_opnn(
|
989
|
+
use_this_namespace = NAMESPACE
|
990
|
+
)
|
991
|
+
::Colours::GREY+
|
992
|
+
use_this_namespace+
|
993
|
+
': '+
|
994
|
+
::Colours::REVERT
|
995
|
+
end; alias ropnn return_opnn # === ropnn
|
996
|
+
|
997
|
+
# ========================================================================= #
|
998
|
+
# === set_this_cd_alias_to
|
999
|
+
# ========================================================================= #
|
1000
|
+
def set_this_cd_alias_to(
|
1001
|
+
cd_alias,
|
1002
|
+
new_content,
|
1003
|
+
be_verbose = :default
|
1004
|
+
)
|
1005
|
+
Studium.set_this_cd_alias_to(cd_alias, new_content, be_verbose)
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
# ========================================================================= #
|
1009
|
+
# === return_all_exams_on_this_day
|
1010
|
+
# ========================================================================= #
|
1011
|
+
def return_all_exams_on_this_day(i)
|
1012
|
+
Studium.return_all_exams_on_this_day(i)
|
1013
|
+
end
|
1014
|
+
|
1015
|
+
# ========================================================================= #
|
1016
|
+
# === average_grade
|
1017
|
+
# ========================================================================= #
|
1018
|
+
def average_grade(
|
1019
|
+
i = :default,
|
1020
|
+
round_to = 2 # ← Round to two numbers.
|
1021
|
+
)
|
1022
|
+
require 'studium/exams/average_grade/average_grade.rb'
|
1023
|
+
Studium.average_grade(i, round_to)
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
# ========================================================================= #
|
1027
|
+
# === remove_leading_comments
|
1028
|
+
# ========================================================================= #
|
1029
|
+
def remove_leading_comments(i)
|
1030
|
+
if i.is_a? Array
|
1031
|
+
i.reject {|line| line.start_with? '#' }
|
1032
|
+
end
|
1033
|
+
end
|
1034
|
+
|
1035
|
+
# ========================================================================= #
|
1036
|
+
# === remove_empty_strings
|
1037
|
+
#
|
1038
|
+
# This method presently only works on Arrays. We will reject empty
|
1039
|
+
# Strings from the Array at hand.
|
1040
|
+
# ========================================================================= #
|
1041
|
+
def remove_empty_strings(i)
|
1042
|
+
if i.is_a? Array
|
1043
|
+
i.reject {|line| line.empty? }
|
1044
|
+
end
|
1045
|
+
end
|
1046
|
+
|
1047
|
+
# ========================================================================= #
|
1048
|
+
# === sanitize_this_topic (sanitize tag, alias tag)
|
1049
|
+
#
|
1050
|
+
# This entry keeps all possible aliases to commonly used topics, in
|
1051
|
+
# particular abbreviations.
|
1052
|
+
# ========================================================================= #
|
1053
|
+
def sanitize_this_topic(this_topic)
|
1054
|
+
Studium.sanitize_this_theme_topic(this_topic)
|
1055
|
+
end
|
1056
|
+
|
1057
|
+
# ========================================================================= #
|
1058
|
+
# === replace_regular_numbers_with_unicode_numbers
|
1059
|
+
#
|
1060
|
+
# This method will replace numbers such as 1 with ¹.
|
1061
|
+
# ========================================================================= #
|
1062
|
+
def replace_regular_numbers_with_unicode_numbers(i)
|
1063
|
+
::Studium.replace_regular_numbers_with_unicode_numbers(i)
|
1064
|
+
end
|
1065
|
+
|
1066
|
+
# ========================================================================= #
|
1067
|
+
# === return_dataset_for_this_topic
|
1068
|
+
# ========================================================================= #
|
1069
|
+
def return_dataset_for_this_topic(i)
|
1070
|
+
Studium.return_dataset_for_this_topic(i)
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
# ========================================================================= #
|
1074
|
+
# === cheering_person
|
1075
|
+
# ========================================================================= #
|
1076
|
+
def cheering_person
|
1077
|
+
'\o/'
|
1078
|
+
end; alias cheering_person? cheering_person # === cheering_person?
|
1079
|
+
alias cheering_dude? cheering_person # === cheering_dude?
|
1080
|
+
|
1081
|
+
# ========================================================================= #
|
1082
|
+
# === return_solved_lectures
|
1083
|
+
#
|
1084
|
+
# This method will return only those entries that have the key
|
1085
|
+
# :already_solved set to true.
|
1086
|
+
# ========================================================================= #
|
1087
|
+
def return_solved_lectures
|
1088
|
+
already_solved = select_lectures_with_this_key(:already_solved).select {|a,b|
|
1089
|
+
obtain(:already_solved, b) == true
|
1090
|
+
}
|
1091
|
+
already_solved
|
1092
|
+
end
|
1093
|
+
|
1094
|
+
# ========================================================================= #
|
1095
|
+
# === sanitize_url
|
1096
|
+
#
|
1097
|
+
# This is such a useful method that we will use it for all subclasses
|
1098
|
+
# of Studium::Base.
|
1099
|
+
# ========================================================================= #
|
1100
|
+
def sanitize_url(
|
1101
|
+
i,
|
1102
|
+
optional_extra_modes = nil
|
1103
|
+
)
|
1104
|
+
Studium.sanitize_url(i, optional_extra_modes)
|
1105
|
+
end; alias sanitized_url sanitize_url # === sanitized_url
|
1106
|
+
|
1107
|
+
# ========================================================================= #
|
1108
|
+
# === web_liner
|
1109
|
+
# ========================================================================= #
|
1110
|
+
def web_liner(this_token = '*')
|
1111
|
+
(this_token * 80)+N
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
# ========================================================================= #
|
1115
|
+
# === return_directory_for
|
1116
|
+
#
|
1117
|
+
# This method will try to build up the most plausible, local path to
|
1118
|
+
# an existing directory.
|
1119
|
+
# ========================================================================= #
|
1120
|
+
def return_directory_for(
|
1121
|
+
name_of_the_lecture,
|
1122
|
+
university
|
1123
|
+
)
|
1124
|
+
Studium.return_directory_for(name_of_the_lecture, university)
|
1125
|
+
end
|
1126
|
+
|
1127
|
+
# ========================================================================= #
|
1128
|
+
# === return_steop_lectures (steop tag)
|
1129
|
+
#
|
1130
|
+
# This method will return all registered STEOP lectures.
|
1131
|
+
#
|
1132
|
+
# The optional argument will determine whether solved STEOP lectures
|
1133
|
+
# will also be returned. By default this is not the case, meaning
|
1134
|
+
# that we will ignore STEOP lectures that have already been solved.
|
1135
|
+
# ========================================================================= #
|
1136
|
+
def return_steop_lectures(
|
1137
|
+
optional_ignore_already_completed_steop_lectures = true
|
1138
|
+
)
|
1139
|
+
if ::Studium.main_dataset?
|
1140
|
+
dataset = ::Studium.main_dataset?
|
1141
|
+
else
|
1142
|
+
dataset = return_dataset_from_the_file_lecture_information
|
1143
|
+
end
|
1144
|
+
selection = dataset.select {|a, b|
|
1145
|
+
b.has_key?(:is_a_steop_lecture) and (b[:is_a_steop_lecture] == true)
|
1146
|
+
}
|
1147
|
+
if optional_ignore_already_completed_steop_lectures
|
1148
|
+
selection = selection.reject {|a, b|
|
1149
|
+
b.has_key?(:already_solved) and (b[:already_solved] == true)
|
1150
|
+
}
|
1151
|
+
end
|
1152
|
+
return selection
|
1153
|
+
end
|
1154
|
+
|
1155
|
+
# ========================================================================= #
|
1156
|
+
# === remove_newlines
|
1157
|
+
#
|
1158
|
+
# This method will remove newlines, aka "\n", from Strings and Arrays.
|
1159
|
+
# ========================================================================= #
|
1160
|
+
def remove_newlines(i)
|
1161
|
+
if i.is_a? Array
|
1162
|
+
i.map {|entry| remove_newlines(entry) }
|
1163
|
+
else
|
1164
|
+
i.delete(N)
|
1165
|
+
end
|
1166
|
+
end
|
1167
|
+
|
1168
|
+
# ========================================================================= #
|
1169
|
+
# === esystem
|
1170
|
+
# ========================================================================= #
|
1171
|
+
def esystem(i)
|
1172
|
+
::Studium.esystem(i)
|
1173
|
+
end
|
1174
|
+
|
1175
|
+
# ========================================================================= #
|
1176
|
+
# === append_what_into (append tag)
|
1177
|
+
#
|
1178
|
+
# Use this method to save data into a specific file.
|
1179
|
+
# ========================================================================= #
|
1180
|
+
def append_what_into(what, into)
|
1181
|
+
Studium.append_what_into(what, into)
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
# ========================================================================= #
|
1185
|
+
# === ruby_src_dir_at_home?
|
1186
|
+
# ========================================================================= #
|
1187
|
+
def ruby_src_dir_at_home?
|
1188
|
+
Studium.ruby_src_dir_at_home?
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
# ========================================================================= #
|
1192
|
+
# === replace_italic_token_with_this_colour
|
1193
|
+
#
|
1194
|
+
# This method can be used to replace <i></i> with the corresponding
|
1195
|
+
# colour code on the terminal.
|
1196
|
+
# ========================================================================= #
|
1197
|
+
def replace_italic_token_with_this_colour(
|
1198
|
+
i, use_this_colour = :mediumseagreen
|
1199
|
+
)
|
1200
|
+
use_this_regex = /<it?>([A-Za-zöäüÖÄÜ\s]+)<\/it?>/ # See: https://rubular.com/r/mZb1ZtGHCLhg2U
|
1201
|
+
i.gsub(
|
1202
|
+
use_this_regex,
|
1203
|
+
::Colours.string_italic('\1')+
|
1204
|
+
::Colours.remove_trailing_escape_code(
|
1205
|
+
::Colours.send(use_this_colour.to_sym, '')
|
1206
|
+
)
|
1207
|
+
)+
|
1208
|
+
::Colours.send(use_this_colour,'')
|
1209
|
+
end
|
1210
|
+
|
1211
|
+
# ========================================================================= #
|
1212
|
+
# === return_the_remote_homepage_url
|
1213
|
+
#
|
1214
|
+
# The first parameter denotes which particular lecture is to be
|
1215
|
+
# investigated, in regards to its homepage-URL.
|
1216
|
+
#
|
1217
|
+
# The second parameter should contain the hash-dataset that is to be
|
1218
|
+
# used.
|
1219
|
+
# ========================================================================= #
|
1220
|
+
def return_the_remote_homepage_url(
|
1221
|
+
of_this_lecture, dataset_to_use
|
1222
|
+
)
|
1223
|
+
of_this_lecture.strip!
|
1224
|
+
_ = dataset_to_use
|
1225
|
+
if _.has_key? :homepage
|
1226
|
+
_ = _[:homepage]
|
1227
|
+
else
|
1228
|
+
e "No :homepage entry for `#{sfancy(of_this_lecture.to_s)}`."
|
1229
|
+
end
|
1230
|
+
return _
|
1231
|
+
end
|
1232
|
+
|
1233
|
+
# ========================================================================= #
|
1234
|
+
# === remove_tags_from_this_input
|
1235
|
+
#
|
1236
|
+
# This method will return all HTML-like tags from the given input String.
|
1237
|
+
# ========================================================================= #
|
1238
|
+
def remove_tags_from_this_input(i)
|
1239
|
+
return Studium.remove_tags(i)
|
1240
|
+
end; alias remove_tags remove_tags_from_this_input # === remove_tags
|
1241
|
+
|
1242
|
+
# ========================================================================= #
|
1243
|
+
# === use_opn?
|
1244
|
+
# ========================================================================= #
|
1245
|
+
def use_opn?
|
1246
|
+
@internal_hash[:use_opn]
|
1247
|
+
end
|
1248
|
+
|
1249
|
+
# ========================================================================= #
|
1250
|
+
# === do_not_use_opn
|
1251
|
+
# ========================================================================= #
|
1252
|
+
def do_not_use_opn
|
1253
|
+
@internal_hash[:use_opn] = false
|
1254
|
+
end
|
1255
|
+
|
1256
|
+
# ========================================================================= #
|
1257
|
+
# === studium_directory_at_home?
|
1258
|
+
# ========================================================================= #
|
1259
|
+
def studium_directory_at_home?
|
1260
|
+
Studium.studium_directory_at_home?
|
1261
|
+
end; alias studium_directory_at_home? studium_directory_at_home? # === studium_directory_at_home?
|
1262
|
+
|
1263
|
+
# ========================================================================= #
|
1264
|
+
# === has_a_master_curriculum?
|
1265
|
+
#
|
1266
|
+
# This method will return true if the given Array has any master
|
1267
|
+
# curriculum; and it will return false otherwise.
|
1268
|
+
#
|
1269
|
+
# Note that there is an alias called
|
1270
|
+
# "is_this_lecture_registered_in_a_master_curriculum?". The name is a
|
1271
|
+
# of a misnomer, since the input to this method should be an Array
|
1272
|
+
# containing the IDs of the Curricula for which that lecture is
|
1273
|
+
# registered. This may be subject for change one day, but for
|
1274
|
+
# now (Sep 2018) we will keep it that way.
|
1275
|
+
# ========================================================================= #
|
1276
|
+
def has_a_master_curriculum?(array)
|
1277
|
+
Studium.has_a_master_curriculum?(array)
|
1278
|
+
end; alias is_a_master_curriculum? has_a_master_curriculum? # === is_a_master_curriculum?
|
1279
|
+
alias has_a_master_lecture? has_a_master_curriculum? # === has_a_master_lecture?
|
1280
|
+
alias has_a_master_curriculum_entry? has_a_master_curriculum? # === has_a_master_curriculum_entry?
|
1281
|
+
alias is_this_lecture_registered_in_a_master_curriculum? has_a_master_curriculum? # === is_this_lecture_registered_in_a_master_curriculum?
|
1282
|
+
alias does_this_include_a_master_curriculum? has_a_master_curriculum? # === does_this_include_a_master_curriculum?
|
1283
|
+
|
1284
|
+
# ========================================================================= #
|
1285
|
+
# === return_file_for_this_curriculum
|
1286
|
+
#
|
1287
|
+
# This method is a wrapper over the toplevel-method called
|
1288
|
+
# Studium.return_file_for_this_curriculum().
|
1289
|
+
# ========================================================================= #
|
1290
|
+
def return_file_for_this_curriculum(
|
1291
|
+
i = :bachelor_basisblock_biologie
|
1292
|
+
)
|
1293
|
+
if i.is_a? Array
|
1294
|
+
i.map {|line|
|
1295
|
+
return_file_for_this_curriculum(line)
|
1296
|
+
}
|
1297
|
+
else
|
1298
|
+
# ===================================================================== #
|
1299
|
+
#
|
1300
|
+
# bl $RUBY_STUDIUM/constants/return_file_for_this_curriculum.rb
|
1301
|
+
#
|
1302
|
+
# ===================================================================== #
|
1303
|
+
Studium.return_file_for_this_curriculum(i)
|
1304
|
+
end
|
1305
|
+
end; alias return_curriculum_file_based_on_this_input return_file_for_this_curriculum # === return_curriculum_file_based_on_this_input
|
1306
|
+
alias curriculum_location_of return_file_for_this_curriculum # === curriculum_location_of
|
1307
|
+
alias return_path_of_this_curriculum return_file_for_this_curriculum # === return_path_of_this_curriculum
|
1308
|
+
alias return_path_to_the_curriculum_file return_file_for_this_curriculum # === return_path_to_the_curriculum_file
|
1309
|
+
alias return_file_associated_with_this_curriculum return_file_for_this_curriculum # === return_file_associated_with_this_curriculum
|
1310
|
+
alias location_of_this_curriculum_file? return_file_for_this_curriculum # === location_of_this_curriculum_file?
|
1311
|
+
|
1312
|
+
# ========================================================================= #
|
1313
|
+
# === obtain_lectures_from_this_curriculum
|
1314
|
+
#
|
1315
|
+
# This method should be used whenever you wish to obtain all lectures
|
1316
|
+
# that belong to a specific curriculum, without any comments.
|
1317
|
+
#
|
1318
|
+
# An Array will be returned by this method.
|
1319
|
+
# ========================================================================= #
|
1320
|
+
def obtain_lectures_from_this_curriculum(
|
1321
|
+
i = :default,
|
1322
|
+
do_flatten_the_result = true
|
1323
|
+
)
|
1324
|
+
Studium.read_dataset_from_a_curriculum_file(i, :remove_comments, do_flatten_the_result).map {|entry|
|
1325
|
+
entry.squeeze(' ') # ← We don't want multiple ' ' in succession here.
|
1326
|
+
}
|
1327
|
+
end; alias return_lectures_from_this_curriculum obtain_lectures_from_this_curriculum # === return_lectures_from_this_curriculum
|
1328
|
+
alias return_lectures_of_this_curriculum obtain_lectures_from_this_curriculum # === return_lectures_of_this_curriculum
|
1329
|
+
alias return_lectures_from_this_curriculu obtain_lectures_from_this_curriculum # === return_lectures_from_this_curriculu
|
1330
|
+
alias return_lectures_from_this_curriculum_file obtain_lectures_from_this_curriculum # === return_lectures_from_this_curriculum_file
|
1331
|
+
|
1332
|
+
# ========================================================================= #
|
1333
|
+
# === fetch_this_curriculum
|
1334
|
+
#
|
1335
|
+
# This method can be used to specifically read in a registered local
|
1336
|
+
# curriculum.
|
1337
|
+
# ========================================================================= #
|
1338
|
+
def fetch_this_curriculum(i, &block)
|
1339
|
+
path = map_input_to_this_curriculum_filename(i)
|
1340
|
+
_ = readlines_with_proper_encoding(path, &block)
|
1341
|
+
if _
|
1342
|
+
return _.reject {|line|
|
1343
|
+
line.strip.empty? or line.strip.start_with?('#')
|
1344
|
+
}.map {|entry|
|
1345
|
+
entry.strip!
|
1346
|
+
entry.squeeze!(' ')
|
1347
|
+
if entry.include?('#')
|
1348
|
+
entry = entry.split('#').first.to_s
|
1349
|
+
end
|
1350
|
+
entry.strip
|
1351
|
+
}
|
1352
|
+
else
|
1353
|
+
false
|
1354
|
+
end
|
1355
|
+
end
|
1356
|
+
|
1357
|
+
# ========================================================================= #
|
1358
|
+
# === return_title_from_this_curriculum_file
|
1359
|
+
#
|
1360
|
+
# The first argument to this method should be the abbreviation of
|
1361
|
+
# that particular curriculum.
|
1362
|
+
#
|
1363
|
+
# Note that an Array can also be given as input to this method; this
|
1364
|
+
# may be done if a curriculum consists of more than one block.
|
1365
|
+
#
|
1366
|
+
# Usage example:
|
1367
|
+
#
|
1368
|
+
# return_title_from_this_curriculum_file(:indi2)
|
1369
|
+
#
|
1370
|
+
# ========================================================================= #
|
1371
|
+
def return_title_from_this_curriculum_file(
|
1372
|
+
i,
|
1373
|
+
use_a_shorter_name = false
|
1374
|
+
)
|
1375
|
+
Studium.return_title_from_this_curriculum_file(i, use_a_shorter_name)
|
1376
|
+
end; alias return_title_of return_title_from_this_curriculum_file # === return_title_of
|
1377
|
+
alias return_pretty_title_of_this_curriculum return_title_from_this_curriculum_file # === return_pretty_title_of_this_curriculum
|
1378
|
+
alias return_title_of_this_curriculum return_title_from_this_curriculum_file # === return_title_of_this_curriculum
|
1379
|
+
|
1380
|
+
# ========================================================================= #
|
1381
|
+
# === total_ects_points_passed
|
1382
|
+
# ========================================================================= #
|
1383
|
+
def total_ects_points_passed(i)
|
1384
|
+
Studium.total_ects_points_passed(i)
|
1385
|
+
end
|
1386
|
+
|
1387
|
+
# ========================================================================= #
|
1388
|
+
# === directory_to_my_exam_topics
|
1389
|
+
# ========================================================================= #
|
1390
|
+
def directory_to_my_exam_topics
|
1391
|
+
Studium.directory_to_my_exam_topics
|
1392
|
+
end
|
1393
|
+
|
1394
|
+
# ========================================================================= #
|
1395
|
+
# === directory_to_the_exam_topics?
|
1396
|
+
# ========================================================================= #
|
1397
|
+
def directory_to_the_exam_topics?
|
1398
|
+
Studium.directory_to_the_exam_topics?
|
1399
|
+
end; alias path_to_exam_topic? directory_to_the_exam_topics? # === path_to_exam_topic?
|
1400
|
+
alias directory_of_the_exam_topics? directory_to_the_exam_topics? # === directory_of_the_exam_topics?
|
1401
|
+
|
1402
|
+
# ========================================================================= #
|
1403
|
+
# === rename_konsole_tab?
|
1404
|
+
# ========================================================================= #
|
1405
|
+
def rename_konsole_tab?(
|
1406
|
+
i = FILE_RENAME_KONSOLE_TAB
|
1407
|
+
)
|
1408
|
+
if File.exist? i
|
1409
|
+
YAML.load_file(i)
|
1410
|
+
else
|
1411
|
+
false
|
1412
|
+
end
|
1413
|
+
end
|
1414
|
+
|
1415
|
+
# ========================================================================= #
|
1416
|
+
# === replace_italic_token_with_default_colour
|
1417
|
+
# ========================================================================= #
|
1418
|
+
def replace_italic_token_with_default_colour(i, colour_to_use = :royalblue)
|
1419
|
+
replace_italic_token_with_this_colour(i, colour_to_use)
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
# ========================================================================= #
|
1423
|
+
# === replace_underline_token_with_default_colour
|
1424
|
+
# ========================================================================= #
|
1425
|
+
def replace_underline_token_with_default_colour(i, colour_to_use = :royalblue)
|
1426
|
+
replace_underline_token_with_this_colour(i, colour_to_use)
|
1427
|
+
end
|
1428
|
+
|
1429
|
+
# ========================================================================= #
|
1430
|
+
# === replace_underline_token_with_this_colour
|
1431
|
+
#
|
1432
|
+
# We can use either <ud> or <u>, so we have to check for both variants.
|
1433
|
+
# ========================================================================= #
|
1434
|
+
def replace_underline_token_with_this_colour(
|
1435
|
+
i, use_this_colour = :royalblue # This default colour is rarely in use.
|
1436
|
+
)
|
1437
|
+
if (i.include?('<ud>') and i.include?('</ud>')) or
|
1438
|
+
(i.include?('<u>') and i.include?('</u>'))
|
1439
|
+
# ===================================================================== #
|
1440
|
+
# Next, set up a non-greedy explicit regex:
|
1441
|
+
#
|
1442
|
+
# https://rubular.com/r/uNnBwWc35LKjXX
|
1443
|
+
#
|
1444
|
+
# ===================================================================== #
|
1445
|
+
use_this_regex = /<ud?>([-a-züöäA-ZÜÖÄ0-9\/%, \n\.]+?)<\/ud?>/
|
1446
|
+
i = i.dup if i.frozen?
|
1447
|
+
i.gsub!(
|
1448
|
+
use_this_regex,
|
1449
|
+
::Colours.string_underline('\1')+
|
1450
|
+
::Colours.remove_trailing_escape_code(
|
1451
|
+
::Colours.send(use_this_colour.to_sym, '')
|
1452
|
+
)
|
1453
|
+
)
|
1454
|
+
end
|
1455
|
+
return i
|
1456
|
+
end
|
1457
|
+
|
1458
|
+
# ========================================================================= #
|
1459
|
+
# === roebe_exam_directory?
|
1460
|
+
# ========================================================================= #
|
1461
|
+
def roebe_exam_directory?
|
1462
|
+
"#{RUBY_STUDIUM_HOME_DIR}exam_topics/"
|
1463
|
+
end
|
1464
|
+
|
1465
|
+
# ========================================================================= #
|
1466
|
+
# === colourize_percentage
|
1467
|
+
#
|
1468
|
+
# This method should be used when we wish to display percentage
|
1469
|
+
# values on the commandline.
|
1470
|
+
# ========================================================================= #
|
1471
|
+
def colourize_percentage(i)
|
1472
|
+
return seagreen(i) if use_colours? # Used to be cadetblue.
|
1473
|
+
return i
|
1474
|
+
end
|
1475
|
+
|
1476
|
+
# ========================================================================= #
|
1477
|
+
# === remove_escape_sequences
|
1478
|
+
# ========================================================================= #
|
1479
|
+
def remove_escape_sequences(i)
|
1480
|
+
::Colours.remove_escape_sequences(i)
|
1481
|
+
end
|
1482
|
+
|
1483
|
+
require 'studium/toplevel_methods/word_wrap.rb'
|
1484
|
+
# ========================================================================= #
|
1485
|
+
# === word_wrap
|
1486
|
+
#
|
1487
|
+
# This method can re-arrange a given text (a String) to honour a certain
|
1488
|
+
# size limit, such as 80 characters per line.
|
1489
|
+
#
|
1490
|
+
# Keep in mind that colours that may be used inside of a tag, such as
|
1491
|
+
# <tomato>foobar</tomato>, will also count for that limit. This has
|
1492
|
+
# to be remembered when doing the calculation for text-wrapping.
|
1493
|
+
# ========================================================================= #
|
1494
|
+
def word_wrap(
|
1495
|
+
text,
|
1496
|
+
line_width = N_CHARACTERS_PER_LINE
|
1497
|
+
)
|
1498
|
+
::Studium.word_wrap(text, line_width)
|
1499
|
+
end
|
1500
|
+
|
1501
|
+
# ========================================================================= #
|
1502
|
+
# === eparse
|
1503
|
+
#
|
1504
|
+
# The colours for this method are defined within the method body.
|
1505
|
+
#
|
1506
|
+
# We could also delegate to ::Colours.eparse() instead.
|
1507
|
+
# ========================================================================= #
|
1508
|
+
def eparse(
|
1509
|
+
i,
|
1510
|
+
use_colours = use_colours?
|
1511
|
+
)
|
1512
|
+
if use_colours
|
1513
|
+
token = '#'
|
1514
|
+
if i.include? token
|
1515
|
+
splitted = i.split(token)
|
1516
|
+
splitted[-1] = olive(splitted[-1])
|
1517
|
+
i = splitted.join(royalblue(token))
|
1518
|
+
end
|
1519
|
+
end
|
1520
|
+
e i
|
1521
|
+
end; alias ecolourize eparse # === ecolourize
|
1522
|
+
|
1523
|
+
# ========================================================================= #
|
1524
|
+
# === vertical_bar?
|
1525
|
+
# ========================================================================= #
|
1526
|
+
def vertical_bar?
|
1527
|
+
return '|'
|
1528
|
+
end
|
1529
|
+
|
1530
|
+
# ========================================================================= #
|
1531
|
+
# === horizontal_bar?
|
1532
|
+
# ========================================================================= #
|
1533
|
+
def horizontal_bar?
|
1534
|
+
return '―'
|
1535
|
+
end
|
1536
|
+
|
1537
|
+
# ========================================================================= #
|
1538
|
+
# === shall_we_make_use_of_unicode_symbols?
|
1539
|
+
#
|
1540
|
+
# The most common idiom for using this method is actually via:
|
1541
|
+
#
|
1542
|
+
# if use_unicode_symbols?
|
1543
|
+
#
|
1544
|
+
# ========================================================================= #
|
1545
|
+
def shall_we_make_use_of_unicode_symbols?
|
1546
|
+
::Studium.shall_we_make_use_of_unicode_symbols?
|
1547
|
+
end; alias use_unicode_symbols? shall_we_make_use_of_unicode_symbols? # === use_unicode_symbols?
|
1548
|
+
alias use_unicode? shall_we_make_use_of_unicode_symbols? # === use_unicode?
|
1549
|
+
|
1550
|
+
# ========================================================================= #
|
1551
|
+
# === unicode_blocks_line
|
1552
|
+
#
|
1553
|
+
# This method will "draw" a (horizontal) unicode-blocks line, that is,
|
1554
|
+
# a line that is "built" from unicode blocks.
|
1555
|
+
#
|
1556
|
+
# The optional first argument can be used to use a specific colour.
|
1557
|
+
#
|
1558
|
+
# Usage examples:
|
1559
|
+
#
|
1560
|
+
# unicode_blocks_line :steelblue
|
1561
|
+
# unicode_blocks_line(:steelblue) {{ n_tokens: 84 }}
|
1562
|
+
#
|
1563
|
+
# ========================================================================= #
|
1564
|
+
def unicode_blocks_line(
|
1565
|
+
optional_use_this_colour = nil,
|
1566
|
+
use_n_tokens = :default, # <- This defaults to 78.
|
1567
|
+
use_this_unicode_token = :upper_half_block
|
1568
|
+
)
|
1569
|
+
case use_n_tokens
|
1570
|
+
when :default # Must come before we check for a given block.
|
1571
|
+
use_n_tokens = 78
|
1572
|
+
end
|
1573
|
+
if block_given?
|
1574
|
+
yielded = yield
|
1575
|
+
if yielded.is_a? Hash
|
1576
|
+
if yielded.has_key? :n_tokens
|
1577
|
+
use_n_tokens = yielded.delete(:n_tokens)
|
1578
|
+
end
|
1579
|
+
end
|
1580
|
+
end
|
1581
|
+
begin
|
1582
|
+
require 'roebe/toplevel_methods/unicode/unicode_block_elements.rb'
|
1583
|
+
rescue LoadError; end
|
1584
|
+
_ = (Roebe.send(use_this_unicode_token) * use_n_tokens)
|
1585
|
+
if optional_use_this_colour
|
1586
|
+
_ = ::Colours::AllColourMethods.send(optional_use_this_colour, _)
|
1587
|
+
end
|
1588
|
+
return _
|
1589
|
+
end
|
1590
|
+
|
1591
|
+
# ========================================================================= #
|
1592
|
+
# === file_lecture_information?
|
1593
|
+
# ========================================================================= #
|
1594
|
+
def file_lecture_information?
|
1595
|
+
::Studium.file_lecture_information?
|
1596
|
+
end
|
1597
|
+
|
1598
|
+
# ========================================================================= #
|
1599
|
+
# === infer_the_namespace
|
1600
|
+
#
|
1601
|
+
# This will assume the true namespace from the inspectable name.
|
1602
|
+
# ========================================================================= #
|
1603
|
+
def infer_the_namespace
|
1604
|
+
_ = inspect.to_s.delete('<')
|
1605
|
+
if _.include? ' '
|
1606
|
+
_ = _.split(' ').first.delete('#')
|
1607
|
+
if _.include? ':'
|
1608
|
+
_ = _.split(':')[0 .. -2].reject {|entry| entry.empty? }.join('::')
|
1609
|
+
end
|
1610
|
+
end
|
1611
|
+
@internal_hash[:namespace] = _ # And assign it here.
|
1612
|
+
end
|
1613
|
+
|
1614
|
+
# ========================================================================= #
|
1615
|
+
# === left_arrow
|
1616
|
+
# ========================================================================= #
|
1617
|
+
def left_arrow?
|
1618
|
+
'←'
|
1619
|
+
end; alias left_arrow left_arrow? # === left_arrow
|
1620
|
+
|
1621
|
+
# ========================================================================= #
|
1622
|
+
# === is_prüfungsimmanent?
|
1623
|
+
#
|
1624
|
+
# This method can determine whether a course is "prüfungsimmanent",
|
1625
|
+
# aka whether this course requires continuous, mandatory presence
|
1626
|
+
# (of the student).
|
1627
|
+
#
|
1628
|
+
# The argument to this method should be the type of the lecture at
|
1629
|
+
# hand, such as "VO" or "VU" or "SE" or "PR", as a String.
|
1630
|
+
#
|
1631
|
+
# The method will always return a boolean value, aka true or
|
1632
|
+
# false. If true is the return value then this means that "yes,
|
1633
|
+
# this course requires mandatory presence".
|
1634
|
+
# ========================================================================= #
|
1635
|
+
def is_prüfungsimmanent?(
|
1636
|
+
i, ignore_these_types = nil
|
1637
|
+
)
|
1638
|
+
Studium.is_prüfungsimmanent?(i, ignore_these_types)
|
1639
|
+
end; alias is_a_prüfungsimmanent_course? is_prüfungsimmanent? # === is_a_prüfungsimmanent_course?
|
1640
|
+
alias is_this_a_prüfungsimment_course? is_prüfungsimmanent? # === is_this_a_prüfungsimment_course?
|
1641
|
+
alias is_this_a_prüfungsimmanent_course? is_prüfungsimmanent? # === is_this_a_prüfungsimmanent_course?
|
1642
|
+
|
1643
|
+
# ========================================================================= #
|
1644
|
+
# === right_arrow?
|
1645
|
+
# ========================================================================= #
|
1646
|
+
def right_arrow?
|
1647
|
+
UNICODE_RIGHT_ARROW
|
1648
|
+
end; alias right_arrow right_arrow? # === right_arrow
|
1649
|
+
alias rarrow right_arrow? # === rarrow
|
1650
|
+
alias rarrow? right_arrow? # === rarrow?
|
1651
|
+
|
1652
|
+
# ========================================================================= #
|
1653
|
+
# === has_lva_dates_registered?
|
1654
|
+
# ========================================================================= #
|
1655
|
+
def has_lva_dates_registered?(i)
|
1656
|
+
return false if i.nil? or i.empty? # Reject impossible values quickly.
|
1657
|
+
if i.is_a?(Array) and !i.empty?
|
1658
|
+
true
|
1659
|
+
else
|
1660
|
+
false
|
1661
|
+
end
|
1662
|
+
end; alias has_any_lva_dates_registered? has_lva_dates_registered? # === has_any_lva_dates_registered?
|
1663
|
+
|
1664
|
+
# ========================================================================= #
|
1665
|
+
# === select_for_prüfungsimmanente_LVs
|
1666
|
+
#
|
1667
|
+
# We assume the input to this method is a Hash containing all lectures.
|
1668
|
+
# ========================================================================= #
|
1669
|
+
def select_for_prüfungsimmanente_LVs(i)
|
1670
|
+
i.select {|name_of_the_course, inner_hash|
|
1671
|
+
type = inner_hash[:type]
|
1672
|
+
is_prüfungsimmanent?(type)
|
1673
|
+
}
|
1674
|
+
end
|
1675
|
+
|
1676
|
+
require 'studium/toplevel_methods/is_this_lecture_a_practical_course.rb'
|
1677
|
+
# ========================================================================= #
|
1678
|
+
# === is_this_lecture_a_practical_course?
|
1679
|
+
# ========================================================================= #
|
1680
|
+
def is_this_lecture_a_practical_course?(
|
1681
|
+
this_lecture,
|
1682
|
+
optional_lecture_type = nil
|
1683
|
+
)
|
1684
|
+
::Studium.is_this_lecture_a_practical_course?(this_lecture, optional_lecture_type)
|
1685
|
+
end; alias is_this_lecture_a_practical_course is_this_lecture_a_practical_course? # === is_this_lecture_a_practical_course
|
1686
|
+
alias is_it_a_practical_course? is_this_lecture_a_practical_course? # === is_it_a_practical_course?
|
1687
|
+
|
1688
|
+
# ========================================================================= #
|
1689
|
+
# === beautiful_url
|
1690
|
+
#
|
1691
|
+
# This method can be used to "beautify" a remote URL, based on shorter
|
1692
|
+
# input.
|
1693
|
+
#
|
1694
|
+
# Until 10.12.2019 this method exclusively used BeautifulUrl.
|
1695
|
+
#
|
1696
|
+
# Since as of 10.12.2019, this method will actually tap into
|
1697
|
+
# Studium.return_url_from() if it is registered.
|
1698
|
+
# ========================================================================= #
|
1699
|
+
def beautiful_url(i)
|
1700
|
+
unless Studium.respond_to? :is_this_url_registered?
|
1701
|
+
# ===================================================================== #
|
1702
|
+
# Enable support for that .rb file next.
|
1703
|
+
# ===================================================================== #
|
1704
|
+
require 'studium/toplevel_methods/return_remote_homepage_of_this_lecture.rb'
|
1705
|
+
end
|
1706
|
+
if Studium.is_this_url_registered?(i)
|
1707
|
+
i = Studium.return_url_from(i)
|
1708
|
+
else
|
1709
|
+
i = BeautifulUrl[i]
|
1710
|
+
end
|
1711
|
+
if i.is_a? Array
|
1712
|
+
i = i.first
|
1713
|
+
end
|
1714
|
+
return i
|
1715
|
+
end; alias return_remote_URL beautiful_url # === return_remote_URL
|
1716
|
+
|
1717
|
+
# ========================================================================= #
|
1718
|
+
# === filter_for_all_passed_exams
|
1719
|
+
# ========================================================================= #
|
1720
|
+
def filter_for_all_passed_exams(i)
|
1721
|
+
return i.select {|a, b|
|
1722
|
+
b[:already_solved] and
|
1723
|
+
(b[:already_solved] == true)
|
1724
|
+
}
|
1725
|
+
end
|
1726
|
+
|
1727
|
+
# ========================================================================= #
|
1728
|
+
# === etomato
|
1729
|
+
# ========================================================================= #
|
1730
|
+
def etomato(i)
|
1731
|
+
e tomato(i)
|
1732
|
+
end
|
1733
|
+
|
1734
|
+
# ========================================================================= #
|
1735
|
+
# === is_a_master_lecture?
|
1736
|
+
# ========================================================================= #
|
1737
|
+
def is_a_master_lecture?(i)
|
1738
|
+
Studium.is_a_master_lecture?(i)
|
1739
|
+
end
|
1740
|
+
|
1741
|
+
# ========================================================================= #
|
1742
|
+
# === try_to_require_the_open_gem
|
1743
|
+
# ========================================================================= #
|
1744
|
+
def try_to_require_the_open_gem
|
1745
|
+
begin
|
1746
|
+
require 'open'
|
1747
|
+
rescue LoadError; end
|
1748
|
+
end
|
1749
|
+
|
1750
|
+
# ========================================================================= #
|
1751
|
+
# === roebe_path_to_file_lecture_information?
|
1752
|
+
# ========================================================================= #
|
1753
|
+
def roebe_path_to_file_lecture_information?
|
1754
|
+
'/home/x/programming/ruby/src/studium/lib/studium/yaml/lecture_information/'\
|
1755
|
+
'lecture_information.yml'
|
1756
|
+
end
|
1757
|
+
|
1758
|
+
# ========================================================================= #
|
1759
|
+
# === is_german_weekday?
|
1760
|
+
# ========================================================================= #
|
1761
|
+
def is_german_weekday?(i)
|
1762
|
+
ARRAY_GERMAN_WEEKDAYS.include?(i)
|
1763
|
+
end
|
1764
|
+
|
1765
|
+
# ========================================================================= #
|
1766
|
+
# === add_proper_year_entry_to_this_line
|
1767
|
+
#
|
1768
|
+
# This method will add a proper year entry to a line. It will either
|
1769
|
+
# append a year entry - or, which may be more useful, try to insert
|
1770
|
+
# the year-entry into a position that fits. The latter will make
|
1771
|
+
# use of a regex.
|
1772
|
+
#
|
1773
|
+
# A test string for the latter is the following:
|
1774
|
+
#
|
1775
|
+
# "Dienstag 02.10. 11:30-13:00 UZA2 Hörsaal 5 Raum 2Z202 2.OG"
|
1776
|
+
#
|
1777
|
+
# ========================================================================= #
|
1778
|
+
def add_proper_year_entry_to_this_line(line)
|
1779
|
+
result = line.dup
|
1780
|
+
current_year = Time.now.year
|
1781
|
+
use_this_regex = # See: https://rubular.com/r/xV0yNSYhWW
|
1782
|
+
/^(.+)(\d{2}\.\d{1,2}\.) (\d{1,2}:\d{1,2}(-| )?\d{1,2}:\d{1,2})(.+)$/
|
1783
|
+
if result =~ use_this_regex
|
1784
|
+
result.sub!(use_this_regex, '\1\2'+current_year.to_s+', \3\5')
|
1785
|
+
else # this here is the simpler case
|
1786
|
+
result << current_year # This is the variant that will simply append.
|
1787
|
+
end
|
1788
|
+
result
|
1789
|
+
end
|
1790
|
+
|
1791
|
+
# ========================================================================= #
|
1792
|
+
# === parse_this_line_for_date_entry
|
1793
|
+
# ========================================================================= #
|
1794
|
+
def parse_this_line_for_date_entry(i)
|
1795
|
+
use_this_regex = /\d{2}\.\d{2}\.\d{4}/ # See: https://rubular.com/r/ePRbty9Cjo49xv
|
1796
|
+
result = i.scan(use_this_regex).flatten
|
1797
|
+
result = result.first if result.is_a? Array
|
1798
|
+
return result
|
1799
|
+
end
|
1800
|
+
|
1801
|
+
# ========================================================================= #
|
1802
|
+
# === german_weekend_for?
|
1803
|
+
# ========================================================================= #
|
1804
|
+
def german_weekend_for?(
|
1805
|
+
i = '22.11.2022'
|
1806
|
+
)
|
1807
|
+
if Object.const_defined?(:Roebe)
|
1808
|
+
return Roebe.return_german_weekday(i)
|
1809
|
+
end
|
1810
|
+
end
|
1811
|
+
|
1812
|
+
# ========================================================================= #
|
1813
|
+
# === file_passed_exams_per_month
|
1814
|
+
# ========================================================================= #
|
1815
|
+
def file_passed_exams_per_month
|
1816
|
+
Studium.file_passed_exams_per_month
|
1817
|
+
end; alias passed_exams_per_month file_passed_exams_per_month # === passed_exams_per_month
|
1818
|
+
alias local_csv_file? file_passed_exams_per_month # === local_csv_file?
|
1819
|
+
|
1820
|
+
# ========================================================================= #
|
1821
|
+
# === try_to_require_the_verbose_truth_gem
|
1822
|
+
# ========================================================================= #
|
1823
|
+
def try_to_require_the_verbose_truth_gem
|
1824
|
+
begin
|
1825
|
+
require 'verbose_truth'
|
1826
|
+
rescue LoadError
|
1827
|
+
end
|
1828
|
+
end
|
1829
|
+
|
1830
|
+
# ========================================================================= #
|
1831
|
+
# === try_to_require_html_templates
|
1832
|
+
# ========================================================================= #
|
1833
|
+
def try_to_require_html_templates
|
1834
|
+
begin
|
1835
|
+
require 'cyberweb/requires/require_the_html_template.rb'
|
1836
|
+
rescue LoadError
|
1837
|
+
end
|
1838
|
+
end
|
1839
|
+
|
1840
|
+
# ========================================================================= #
|
1841
|
+
# === cliner (cliner tag)
|
1842
|
+
#
|
1843
|
+
# This method can be used such as in the following example, if a specific
|
1844
|
+
# colour is wanted:
|
1845
|
+
#
|
1846
|
+
# cliner('*', :mediumaquamarine)
|
1847
|
+
# cliner { :unicode }
|
1848
|
+
#
|
1849
|
+
# ========================================================================= #
|
1850
|
+
def cliner(
|
1851
|
+
which_token_to_use = :default_token,
|
1852
|
+
use_this_colour = nil,
|
1853
|
+
&block
|
1854
|
+
)
|
1855
|
+
if which_token_to_use.is_a? Hash # Treat Hashes specially.
|
1856
|
+
# ===================================================================== #
|
1857
|
+
# === :colours
|
1858
|
+
# ===================================================================== #
|
1859
|
+
if which_token_to_use.has_key? :colours
|
1860
|
+
use_this_colour = which_token_to_use.delete(:colours)
|
1861
|
+
which_token_to_use = :default_token
|
1862
|
+
# ===================================================================== #
|
1863
|
+
# === :colour
|
1864
|
+
# ===================================================================== #
|
1865
|
+
elsif which_token_to_use.has_key? :colour
|
1866
|
+
use_this_colour = which_token_to_use.delete(:colour)
|
1867
|
+
which_token_to_use = :default_token
|
1868
|
+
end
|
1869
|
+
end
|
1870
|
+
case which_token_to_use
|
1871
|
+
# ======================================================================= #
|
1872
|
+
# === :default_token
|
1873
|
+
# ======================================================================= #
|
1874
|
+
when :default_token
|
1875
|
+
which_token_to_use = '='
|
1876
|
+
end
|
1877
|
+
# ======================================================================= #
|
1878
|
+
# === Handle blocks given to this method next
|
1879
|
+
# ======================================================================= #
|
1880
|
+
if block_given?
|
1881
|
+
yielded = yield
|
1882
|
+
case yielded
|
1883
|
+
# ===================================================================== #
|
1884
|
+
# === :unicode
|
1885
|
+
# ===================================================================== #
|
1886
|
+
when :unicode
|
1887
|
+
begin
|
1888
|
+
require 'roebe/toplevel_methods/unicode/unicode_block_elements.rb'
|
1889
|
+
which_token_to_use = Roebe.horizontal_double_bar.dup
|
1890
|
+
rescue LoadError; end
|
1891
|
+
else
|
1892
|
+
use_this_colour = :mediumaquamarine
|
1893
|
+
end
|
1894
|
+
end
|
1895
|
+
result = (which_token_to_use * 80)
|
1896
|
+
if use_this_colour.is_a? Symbol
|
1897
|
+
if use_this_colour.to_s.include?('konsole_') or
|
1898
|
+
is_this_colour_a_html_colour?(use_this_colour)
|
1899
|
+
unless use_this_colour.to_s.include? '_colour_'
|
1900
|
+
use_this_colour = use_this_colour.to_s
|
1901
|
+
use_this_colour.sub!(/_/,'_colour_')
|
1902
|
+
end
|
1903
|
+
result = COLOURS.send(use_this_colour, result)
|
1904
|
+
end
|
1905
|
+
end
|
1906
|
+
e result
|
1907
|
+
end
|
1908
|
+
|
1909
|
+
# ========================================================================= #
|
1910
|
+
# === german_yes_or_no
|
1911
|
+
# ========================================================================= #
|
1912
|
+
def german_yes_or_no(i)
|
1913
|
+
case i
|
1914
|
+
when true
|
1915
|
+
'ja'
|
1916
|
+
when false
|
1917
|
+
'nein'
|
1918
|
+
end
|
1919
|
+
end
|
1920
|
+
|
1921
|
+
# ========================================================================= #
|
1922
|
+
# === return_german_weekday_of?
|
1923
|
+
# ========================================================================= #
|
1924
|
+
def return_german_weekday_of?(i)
|
1925
|
+
weekday?(i, :german)
|
1926
|
+
end
|
1927
|
+
|
1928
|
+
# ========================================================================= #
|
1929
|
+
# === return_german_name_for_this_english_month
|
1930
|
+
# ========================================================================= #
|
1931
|
+
def return_german_name_for_this_english_month(i)
|
1932
|
+
array = MONTH_NAME_ALIASES_GERMAN_TO_ENGLISH.invert
|
1933
|
+
return array[i]
|
1934
|
+
end; alias to_german_month return_german_name_for_this_english_month # === to_german_month
|
1935
|
+
|
1936
|
+
# ========================================================================= #
|
1937
|
+
# === rinstall2
|
1938
|
+
#
|
1939
|
+
# This method can be used to perform an install-process via oldschool
|
1940
|
+
# setup.rb.
|
1941
|
+
# ========================================================================= #
|
1942
|
+
def rinstall2
|
1943
|
+
cpruby
|
1944
|
+
system 'ruby setup.rb --quiet config'
|
1945
|
+
system 'ruby setup.rb --quiet setup'
|
1946
|
+
system 'ruby setup.rb --quiet install'
|
1947
|
+
delete_file 'setup.rb'
|
1948
|
+
delete_file 'InstalledFiles'
|
1949
|
+
delete_file '.config'
|
1950
|
+
end; alias r2 rinstall2 # === r2
|
1951
|
+
|
1952
|
+
# ========================================================================= #
|
1953
|
+
# === silently_open_in_browser
|
1954
|
+
#
|
1955
|
+
# This method can accept Strings such as
|
1956
|
+
# '/home/x/Temp/studium/html/timetable.html#today'.
|
1957
|
+
# ========================================================================= #
|
1958
|
+
def silently_open_in_browser(into)
|
1959
|
+
try_to_require_the_open_gem unless Object.const_defined?(:Open)
|
1960
|
+
::Open.in_browser(into) { :be_silent }
|
1961
|
+
end
|
1962
|
+
|
1963
|
+
# ========================================================================= #
|
1964
|
+
# === read_this_file_with_default_encoding
|
1965
|
+
#
|
1966
|
+
# This method will read in a file, that should ideally exist, in the
|
1967
|
+
# default project-wide encoding.
|
1968
|
+
#
|
1969
|
+
# A few aliases exist to this method, such as "read_this_file()".
|
1970
|
+
# ========================================================================= #
|
1971
|
+
def read_this_file_with_default_encoding(
|
1972
|
+
this_file
|
1973
|
+
)
|
1974
|
+
File.read(this_file, encoding: ::Studium.main_encoding?)
|
1975
|
+
end; alias read_as_string_with_default_encoding read_this_file_with_default_encoding # === read_as_string_with_default_encoding
|
1976
|
+
alias read_file read_this_file_with_default_encoding # === read_file
|
1977
|
+
alias read_this_file read_this_file_with_default_encoding # === read_this_file
|
1978
|
+
alias read_file_with_default_encoding read_this_file_with_default_encoding # === read_file_with_default_encoding
|
1979
|
+
alias read_in_with_default_encoding read_this_file_with_default_encoding # === read_in_with_default_encoding
|
1980
|
+
|
1981
|
+
# ========================================================================= #
|
1982
|
+
# === german_date_notation
|
1983
|
+
#
|
1984
|
+
# Give a Range as input, and it will give us back a String that
|
1985
|
+
# shows german date notation, aka DD.MM.YYYY.
|
1986
|
+
# ========================================================================= #
|
1987
|
+
def german_date_notation(
|
1988
|
+
i, use_this_token_as_separator = '-'
|
1989
|
+
)
|
1990
|
+
# ======================================================================= #
|
1991
|
+
# === Handle Range objects next
|
1992
|
+
# ======================================================================= #
|
1993
|
+
if i.is_a? Range
|
1994
|
+
start_date = i.begin
|
1995
|
+
end_date = i.end
|
1996
|
+
start_day = start_date.day.to_s.rjust(2, '0')
|
1997
|
+
start_month = start_date.month.to_s.rjust(2, '0')
|
1998
|
+
start_year = start_date.year.to_s
|
1999
|
+
end_day = end_date.day.to_s.rjust(2, '0')
|
2000
|
+
end_month = end_date.month.to_s.rjust(2, '0')
|
2001
|
+
end_year = end_date.year.to_s
|
2002
|
+
i = start_day+'.'+start_month+'.'+start_year+' '+
|
2003
|
+
use_this_token_as_separator+' '+
|
2004
|
+
end_day+'.'+end_month+'.'+end_year
|
2005
|
+
# ======================================================================= #
|
2006
|
+
# === Handle Time objects next
|
2007
|
+
#
|
2008
|
+
# This requires no token.
|
2009
|
+
# ======================================================================= #
|
2010
|
+
elsif i.is_a? Time
|
2011
|
+
i = "#{i.day.to_s.rjust(2, '0')}."\
|
2012
|
+
"#{i.month.to_s.rjust(2, '0')}."\
|
2013
|
+
"#{i.year.to_s}"
|
2014
|
+
end
|
2015
|
+
return i
|
2016
|
+
end; alias german_notation german_date_notation # === german_notation
|
2017
|
+
alias to_german_date german_date_notation # === to_german_date
|
2018
|
+
alias german_formatting_for_the_date german_date_notation # === german_formatting_for_the_date
|
2019
|
+
|
2020
|
+
# ========================================================================= #
|
2021
|
+
# === show_todays_date
|
2022
|
+
# ========================================================================= #
|
2023
|
+
def show_todays_date
|
2024
|
+
e "Today is the #{slateblue(today?)} (#{lightgreen(weekday?)})"
|
2025
|
+
e
|
2026
|
+
end
|
2027
|
+
|
2028
|
+
# ========================================================================= #
|
2029
|
+
# === ensure_that_a_base_directory_exists_for_this_file
|
2030
|
+
#
|
2031
|
+
# This method expects a file path, such as "/tmp/foo/bar.html".
|
2032
|
+
#
|
2033
|
+
# If such a file path is passed to this method then this
|
2034
|
+
# method will try to ensure that /tmp/foo/ exists (the directory).
|
2035
|
+
# ========================================================================= #
|
2036
|
+
def ensure_that_a_base_directory_exists_for_this_file(i)
|
2037
|
+
_ = File.dirname(i)
|
2038
|
+
unless File.directory?(_)
|
2039
|
+
FileUtils.mkdir_p(_)
|
2040
|
+
end
|
2041
|
+
end
|
2042
|
+
|
2043
|
+
# ========================================================================= #
|
2044
|
+
# === does_this_line_include_a_german_weekday?
|
2045
|
+
# ========================================================================= #
|
2046
|
+
def does_this_line_include_a_german_weekday?(i)
|
2047
|
+
ARRAY_GERMAN_WEEKDAYS.any? {|this_german_weekday|
|
2048
|
+
i.include? this_german_weekday
|
2049
|
+
}
|
2050
|
+
end
|
2051
|
+
|
2052
|
+
# ========================================================================= #
|
2053
|
+
# === does_this_line_include_an_english_weekday?
|
2054
|
+
# ========================================================================= #
|
2055
|
+
def does_this_line_include_an_english_weekday?(i)
|
2056
|
+
ARRAY_ENGLISH_WEEKDAYS.any? {|this_english_weekday|
|
2057
|
+
i.include? this_english_weekday
|
2058
|
+
}
|
2059
|
+
end
|
2060
|
+
|
2061
|
+
# ========================================================================= #
|
2062
|
+
# === english_to_german_weekday
|
2063
|
+
#
|
2064
|
+
# This method will simply convert e. g. "Monday" into "Montag". In other
|
2065
|
+
# words: it will convert from the english name for a day into the
|
2066
|
+
# german name of that day.
|
2067
|
+
# ========================================================================= #
|
2068
|
+
def english_to_german_weekday(english_day)
|
2069
|
+
ENGLISH_TO_GERMAN_WEEKDAYS[english_day]
|
2070
|
+
end; alias english_to_german english_to_german_weekday # === english_to_german
|
2071
|
+
|
2072
|
+
# ========================================================================= #
|
2073
|
+
# === n_days_difference_from_today_to_this_day
|
2074
|
+
#
|
2075
|
+
# This method will return a number, which is the amount of days between
|
2076
|
+
# weekdays.
|
2077
|
+
#
|
2078
|
+
# The days are numbered like this:
|
2079
|
+
#
|
2080
|
+
# Monday: 1
|
2081
|
+
# Tuesday: 2
|
2082
|
+
# Wednesday: 3
|
2083
|
+
# Thursday: 4
|
2084
|
+
# Friday: 5
|
2085
|
+
# Saturday: 6
|
2086
|
+
# Sunday: 0
|
2087
|
+
#
|
2088
|
+
# So, how to calculate the time difference to the next day?
|
2089
|
+
#
|
2090
|
+
# Well, say we have the current day be a Wednesday, and the day that is
|
2091
|
+
# to be compared, a Friday. The difference is thus (5 - 3 = 2). If the
|
2092
|
+
# current day is a Saturday, and the input-day is a Friday, then
|
2093
|
+
# the difference must be 5.
|
2094
|
+
#
|
2095
|
+
# If we have, for example, "Friday" to "Tuesday", then this method
|
2096
|
+
# should return the number 4, because the distance is that: Friday,
|
2097
|
+
# Saturday, Sunday and Monday (the start day has to be included, as
|
2098
|
+
# lectures can happen on that day still, e. g. if you check early
|
2099
|
+
# in the morning, you could still have courses in the evening
|
2100
|
+
# slots scheduled).
|
2101
|
+
# ========================================================================= #
|
2102
|
+
def n_days_difference_from_today_to_this_day(
|
2103
|
+
time_now = Time.now,
|
2104
|
+
name_of_the_future_day # ← This ought to be a String, such as "Monday".
|
2105
|
+
)
|
2106
|
+
n_days_difference = 0
|
2107
|
+
weekday_as_number = time_now.wday
|
2108
|
+
name_of_the_future_day = name_of_the_future_day.dup if name_of_the_future_day.frozen?
|
2109
|
+
name_of_the_future_day.strip! # We better strip that input.
|
2110
|
+
start_day = Date::DAYNAMES[weekday_as_number]
|
2111
|
+
# ======================================================================= #
|
2112
|
+
# The next is simply a hardcoded table. We will begin with the
|
2113
|
+
# future day.
|
2114
|
+
# ======================================================================= #
|
2115
|
+
n_days_difference =
|
2116
|
+
case start_day
|
2117
|
+
when 'Monday'
|
2118
|
+
case name_of_the_future_day
|
2119
|
+
when 'Tuesday' then 1
|
2120
|
+
when 'Wednesday' then 2
|
2121
|
+
when 'Thursday' then 3
|
2122
|
+
when 'Friday' then 4
|
2123
|
+
when 'Saturday' then 5
|
2124
|
+
when 'Sunday' then 6
|
2125
|
+
end
|
2126
|
+
when 'Tuesday'
|
2127
|
+
case name_of_the_future_day
|
2128
|
+
when 'Wednesday' then 1
|
2129
|
+
when 'Thursday' then 2
|
2130
|
+
when 'Friday' then 3
|
2131
|
+
when 'Saturday' then 4
|
2132
|
+
when 'Sunday' then 5
|
2133
|
+
when 'Monday' then 6
|
2134
|
+
end
|
2135
|
+
when 'Wednesday'
|
2136
|
+
case name_of_the_future_day
|
2137
|
+
when 'Thursday' then 1
|
2138
|
+
when 'Friday' then 2
|
2139
|
+
when 'Saturday' then 3
|
2140
|
+
when 'Sunday' then 4
|
2141
|
+
when 'Monday' then 5
|
2142
|
+
when 'Tuesday' then 6
|
2143
|
+
end
|
2144
|
+
when 'Thursday'
|
2145
|
+
case name_of_the_future_day
|
2146
|
+
when 'Friday' then 1
|
2147
|
+
when 'Saturday' then 2
|
2148
|
+
when 'Sunday' then 3
|
2149
|
+
when 'Monday' then 4
|
2150
|
+
when 'Tuesday' then 5
|
2151
|
+
when 'Wednesday' then 6
|
2152
|
+
end
|
2153
|
+
when 'Friday'
|
2154
|
+
case name_of_the_future_day
|
2155
|
+
when 'Saturday' then 1
|
2156
|
+
when 'Sunday' then 2
|
2157
|
+
when 'Monday' then 3
|
2158
|
+
when 'Tuesday' then 4
|
2159
|
+
when 'Wednesday' then 5
|
2160
|
+
when 'Thursday' then 6
|
2161
|
+
end
|
2162
|
+
when 'Saturday'
|
2163
|
+
case name_of_the_future_day
|
2164
|
+
when 'Sunday' then 1
|
2165
|
+
when 'Monday' then 2
|
2166
|
+
when 'Tuesday' then 3
|
2167
|
+
when 'Wednesday' then 4
|
2168
|
+
when 'Thursday' then 5
|
2169
|
+
when 'Friday' then 6
|
2170
|
+
end
|
2171
|
+
when 'Sunday'
|
2172
|
+
case name_of_the_future_day
|
2173
|
+
when 'Monday' then 1
|
2174
|
+
when 'Tuesday' then 2
|
2175
|
+
when 'Wednesday' then 3
|
2176
|
+
when 'Thursday' then 4
|
2177
|
+
when 'Friday' then 5
|
2178
|
+
when 'Saturday' then 6
|
2179
|
+
end
|
2180
|
+
end
|
2181
|
+
return n_days_difference
|
2182
|
+
end
|
2183
|
+
|
2184
|
+
# ========================================================================= #
|
2185
|
+
# === return_lva_number_of_this_lecture
|
2186
|
+
# ========================================================================= #
|
2187
|
+
def return_lva_number_of_this_lecture(this_lecture)
|
2188
|
+
::Studium.return_lva_number_of_this_lecture(this_lecture)
|
2189
|
+
end
|
2190
|
+
|
2191
|
+
# ========================================================================= #
|
2192
|
+
# === csv_file?
|
2193
|
+
#
|
2194
|
+
# This method is only useful on my home setup.
|
2195
|
+
# ========================================================================= #
|
2196
|
+
def csv_file?
|
2197
|
+
FILE_PASSED_EXAMS_PER_MONTH
|
2198
|
+
end
|
2199
|
+
|
2200
|
+
# ========================================================================= #
|
2201
|
+
# === does_this_line_include_a_html_colour?
|
2202
|
+
# ========================================================================= #
|
2203
|
+
def does_this_line_include_a_html_colour?(i)
|
2204
|
+
::Colours.does_this_line_include_a_html_colour?(i)
|
2205
|
+
end
|
2206
|
+
|
2207
|
+
# ========================================================================= #
|
2208
|
+
# === translate_dd_mm_yyyy_to_weekday
|
2209
|
+
#
|
2210
|
+
# This method will return the weekday of a given dd.mm.yyyy date.
|
2211
|
+
#
|
2212
|
+
# If the given input is, for example, the String '25.02.2019', then
|
2213
|
+
# this method will return the String 'Monday'.
|
2214
|
+
# ========================================================================= #
|
2215
|
+
def translate_dd_mm_yyyy_to_weekday(
|
2216
|
+
i = '25.02.2020'
|
2217
|
+
)
|
2218
|
+
weekday?(i)
|
2219
|
+
end; alias translate_dd_mm_yyy_to_weekday translate_dd_mm_yyyy_to_weekday # === translate_dd_mm_yyy_to_weekday
|
2220
|
+
|
2221
|
+
# ========================================================================= #
|
2222
|
+
# === hh_mm_ss_dd_mm_yyyy
|
2223
|
+
# ========================================================================= #
|
2224
|
+
def hh_mm_ss_dd_mm_yyyy(i)
|
2225
|
+
"#{hh_mm_ss(i)}-#{dd_mm_yyyy(i)}"
|
2226
|
+
end
|
2227
|
+
|
2228
|
+
# ========================================================================= #
|
2229
|
+
# === replace_all_html_colours_in_this
|
2230
|
+
#
|
2231
|
+
# This method will replace all HTML colours, such as <slateblue>, with
|
2232
|
+
# the corresponding RGB colour variant for the commandline. Typically
|
2233
|
+
# this refers to a terminal such as the KDE konsole, and a shell such
|
2234
|
+
# as bash (although other shells are fine too, and many other terminals,
|
2235
|
+
# such as the gnome-terminal, most likely will work fine as well - but
|
2236
|
+
# it is optimized for the KDE konsole).
|
2237
|
+
#
|
2238
|
+
# This method should only be called after a prior check was done, to
|
2239
|
+
# determine whether the given input String at hand does indeed
|
2240
|
+
# include a valid HTML colour. This can be done via a call to
|
2241
|
+
# the method called line_contains_a_valid_html_colour?().
|
2242
|
+
# ========================================================================= #
|
2243
|
+
def replace_all_html_colours_in_this(
|
2244
|
+
i,
|
2245
|
+
use_this_colour_for_the_default_colour = colour_for_questions?
|
2246
|
+
)
|
2247
|
+
# ======================================================================= #
|
2248
|
+
# bl $RUBY_COLOURS/toplevel_methods/replace_all_html_colours_in_this_line.rb
|
2249
|
+
# ======================================================================= #
|
2250
|
+
::Colours.replace_all_html_colours_in_this_line(
|
2251
|
+
i, use_this_colour_for_the_default_colour
|
2252
|
+
)
|
2253
|
+
end
|
2254
|
+
|
2255
|
+
# ========================================================================= #
|
2256
|
+
# === return_local_path_of_this_pwdstud
|
2257
|
+
# ========================================================================= #
|
2258
|
+
def return_local_path_of_this_pwdstud(i = 1)
|
2259
|
+
Studium.return_local_path_of_this_pwdstud(i)
|
2260
|
+
end
|
2261
|
+
|
2262
|
+
# ========================================================================= #
|
2263
|
+
# === already_solved_this_lva_number?
|
2264
|
+
# ========================================================================= #
|
2265
|
+
def already_solved_this_lva_number?(i)
|
2266
|
+
Studium.already_solved_this_lva_number?(i)
|
2267
|
+
end
|
2268
|
+
|
2269
|
+
# ========================================================================= #
|
2270
|
+
# === debug?
|
2271
|
+
# ========================================================================= #
|
2272
|
+
def debug?
|
2273
|
+
@internal_hash[:debug]
|
2274
|
+
end
|
2275
|
+
|
2276
|
+
# ========================================================================= #
|
2277
|
+
# === german_weekday?
|
2278
|
+
#
|
2279
|
+
# This method will return a german weekday, for the given input. The
|
2280
|
+
# input should be the specific wday at hand.
|
2281
|
+
# ========================================================================= #
|
2282
|
+
def german_weekday?(
|
2283
|
+
i = Date.today.wday
|
2284
|
+
)
|
2285
|
+
weekday?(i, :german)
|
2286
|
+
end; alias weekday_at german_weekday? # === weekday_at
|
2287
|
+
alias german_weekday german_weekday? # === german_weekday
|
2288
|
+
|
2289
|
+
# ========================================================================= #
|
2290
|
+
# === directory_to_the_exam_topics?
|
2291
|
+
#
|
2292
|
+
# This method will point to the directory where all exam topics
|
2293
|
+
# are normally kept; it is simply a "wrapper-method".
|
2294
|
+
# ========================================================================= #
|
2295
|
+
def directory_to_the_exam_topics?
|
2296
|
+
Studium.directory_to_the_exam_topics?
|
2297
|
+
end; alias exam_topics_directory? directory_to_the_exam_topics? # === exam_topics_directory?
|
2298
|
+
alias exam_topic_directory? directory_to_the_exam_topics? # === exam_topic_directory?
|
2299
|
+
|
2300
|
+
# ========================================================================= #
|
2301
|
+
# === opnn
|
2302
|
+
#
|
2303
|
+
# The method also handles blocks.
|
2304
|
+
# ========================================================================= #
|
2305
|
+
def opnn(
|
2306
|
+
i = namespace?,
|
2307
|
+
&block
|
2308
|
+
)
|
2309
|
+
if use_opn?
|
2310
|
+
if i.is_a? String # "Turn" it into a Hash here.
|
2311
|
+
i = { namespace: i }
|
2312
|
+
end
|
2313
|
+
Opn.opn(i, &block)
|
2314
|
+
end
|
2315
|
+
end
|
2316
|
+
|
2317
|
+
# ========================================================================= #
|
2318
|
+
# === is_this_a_valid_html_colour?
|
2319
|
+
#
|
2320
|
+
# This method will let us know whether the given input is a valid (aka
|
2321
|
+
# registered) "html colour". An example for this would be the String
|
2322
|
+
# 'slateblue'.
|
2323
|
+
# ========================================================================= #
|
2324
|
+
def is_this_a_valid_html_colour?(i)
|
2325
|
+
::Studium.is_this_a_valid_html_colour?(i)
|
2326
|
+
end; alias is_this_colour_a_html_colour? is_this_a_valid_html_colour? # === is_this_colour_a_html_colour?
|
2327
|
+
|
2328
|
+
# ========================================================================= #
|
2329
|
+
# === remove_weekday_names_from
|
2330
|
+
#
|
2331
|
+
# This method will remove Strings such as "Monday" or "Montag" from
|
2332
|
+
# the given input argument.
|
2333
|
+
# ========================================================================= #
|
2334
|
+
def remove_weekday_names_from(i)
|
2335
|
+
Studium.remove_weekday_names_from(i)
|
2336
|
+
end; alias remove_weekname_from remove_weekday_names_from # === remove_weekname_from
|
2337
|
+
alias remove_weekdays remove_weekday_names_from # === remove_weekdays
|
2338
|
+
alias remove_weekday_names_from remove_weekday_names_from # === remove_weekday_names_from
|
2339
|
+
alias remove_weeknames_from remove_weekday_names_from # === remove_weeknames_from
|
2340
|
+
alias remove_weeknames remove_weekday_names_from # === remove_weeknames
|
2341
|
+
alias remove_weekday_name remove_weekday_names_from # === remove_weekday_name
|
2342
|
+
|
2343
|
+
# ========================================================================= #
|
2344
|
+
# === return_name_of_the_weekday
|
2345
|
+
#
|
2346
|
+
# This method can be used to return an associated weekday to a specific
|
2347
|
+
# date, such as '22.02.2018'. The format has to be in dd.mm.yyyy.
|
2348
|
+
#
|
2349
|
+
# As mnemonic-helper, Roebe.return_german_weekday "22.11.2022" would
|
2350
|
+
# yield the String "Dienstag".
|
2351
|
+
# ========================================================================= #
|
2352
|
+
def return_name_of_the_weekday(
|
2353
|
+
i = :today
|
2354
|
+
)
|
2355
|
+
begin
|
2356
|
+
require 'roebe/constants/time.rb'
|
2357
|
+
rescue LoadError; end
|
2358
|
+
case i
|
2359
|
+
# ======================================================================= #
|
2360
|
+
# === :today
|
2361
|
+
# ======================================================================= #
|
2362
|
+
when :today
|
2363
|
+
i = Roebe.return_german_weekday(i) if Object.const_defined? :Roebe
|
2364
|
+
end
|
2365
|
+
if i.include? ','
|
2366
|
+
splitted = i.split(',')
|
2367
|
+
first = splitted.first
|
2368
|
+
if first.count('.') > 1
|
2369
|
+
return Roebe.return_german_weekday(first) if Object.const_defined? :Roebe
|
2370
|
+
end
|
2371
|
+
else
|
2372
|
+
return i
|
2373
|
+
end
|
2374
|
+
end; alias return_weekday return_name_of_the_weekday # === return_weekday
|
2375
|
+
|
2376
|
+
# ========================================================================= #
|
2377
|
+
# === has_year_entry?
|
2378
|
+
#
|
2379
|
+
# This method will return a Boolean.
|
2380
|
+
#
|
2381
|
+
# It will return true if the line has a year entry such as '2018'; and
|
2382
|
+
# it will return false, otherwise.
|
2383
|
+
# ========================================================================= #
|
2384
|
+
def has_year_entry?(this_line)
|
2385
|
+
this_line =~ /\d{4}/ # If this line has at the least one entry with 4 numbers.
|
2386
|
+
end; alias this_line_has_a_year_entry? has_year_entry? # === has_year_entry?
|
2387
|
+
|
2388
|
+
# ========================================================================= #
|
2389
|
+
# === do_these_curricula_include_both_a_bachelor_and_a_master_curriculum?(i)
|
2390
|
+
#
|
2391
|
+
# The input to this method should be an Array.
|
2392
|
+
# ========================================================================= #
|
2393
|
+
def do_these_curricula_include_both_a_bachelor_and_a_master_curriculum?(i)
|
2394
|
+
result = false
|
2395
|
+
if i.any? {|entry| entry.start_with?('033')} and
|
2396
|
+
i.any? {|entry| entry.start_with?('066')}
|
2397
|
+
result = true
|
2398
|
+
end
|
2399
|
+
return result
|
2400
|
+
end
|
2401
|
+
|
2402
|
+
# ========================================================================= #
|
2403
|
+
# === bachelor_master_or_diploma
|
2404
|
+
#
|
2405
|
+
# For a given solved lecture, we will determine whether it belongs
|
2406
|
+
# to a Bachelor (B), Master (M) or Diploma (D) curriculum.
|
2407
|
+
#
|
2408
|
+
# For the line:
|
2409
|
+
#
|
2410
|
+
# 13.05.2020 | 1.0 | 1.0 | 1 | BOKU | M | SE | 940003 | 2020S | Emerging Topics in RNA Biology (in Eng.)
|
2411
|
+
# 0 1 2 3 4 5
|
2412
|
+
#
|
2413
|
+
# It would be at 5.
|
2414
|
+
# ========================================================================= #
|
2415
|
+
def bachelor_master_or_diploma(
|
2416
|
+
this_lecture, dataset = nil
|
2417
|
+
)
|
2418
|
+
if dataset.nil? and File.exist? FILE_PASSED_EXAMS_PER_MONTH
|
2419
|
+
dataset = File.readlines(FILE_PASSED_EXAMS_PER_MONTH).reject {|line|
|
2420
|
+
line.strip.empty? or
|
2421
|
+
line.strip.start_with?('#')
|
2422
|
+
}
|
2423
|
+
end
|
2424
|
+
selection = dataset.select {|line|
|
2425
|
+
splitted = this_lecture.split(' ')
|
2426
|
+
lecture_id = splitted.first
|
2427
|
+
course_name = splitted[1..-1].join(' ').strip
|
2428
|
+
line.include?(lecture_id) and
|
2429
|
+
line.include?(course_name)
|
2430
|
+
}
|
2431
|
+
if selection.empty?
|
2432
|
+
'(unknown)'
|
2433
|
+
else
|
2434
|
+
selection = selection.first
|
2435
|
+
return selection.split('|')[5].strip
|
2436
|
+
end
|
2437
|
+
end
|
2438
|
+
|
2439
|
+
# ========================================================================= #
|
2440
|
+
# === return_name_of_this_curriculum
|
2441
|
+
#
|
2442
|
+
# This method will return the official name of a curriculum. In order
|
2443
|
+
# to achieve this, the method will read the file, and grab the second
|
2444
|
+
# line, which should contain the name of the curriculum at hand.
|
2445
|
+
#
|
2446
|
+
# This method will NOT remove strings such as "Bachelorcurriculum"
|
2447
|
+
# or "Mastercurriculum", due to the individual vector-curriculum
|
2448
|
+
# having the very same name (Bachelor + Master).
|
2449
|
+
# ========================================================================= #
|
2450
|
+
def return_name_of_this_curriculum(i)
|
2451
|
+
file = return_file_for_this_curriculum(i)
|
2452
|
+
if file.nil?
|
2453
|
+
e "Something went wrong for the input #{steelblue(i)}."
|
2454
|
+
e 'No match could be found for it. Are you sure that it must exist?'
|
2455
|
+
exit
|
2456
|
+
elsif File.exist? file
|
2457
|
+
dataset = readlines_with_proper_encoding(file)
|
2458
|
+
name = dataset[1].delete('#=').strip
|
2459
|
+
return name
|
2460
|
+
end
|
2461
|
+
end; alias return_long_name_of_this_curriculum return_name_of_this_curriculum # === return_long_name_of_this_curriculum
|
2462
|
+
|
2463
|
+
# ========================================================================= #
|
2464
|
+
# === rds
|
2465
|
+
# ========================================================================= #
|
2466
|
+
def rds(i)
|
2467
|
+
i.squeeze('/')
|
2468
|
+
end
|
2469
|
+
|
2470
|
+
# ========================================================================= #
|
2471
|
+
# === return_all_registered_curricula
|
2472
|
+
# ========================================================================= #
|
2473
|
+
def return_all_registered_curricula
|
2474
|
+
Studium.return_registered_standalone_curricula
|
2475
|
+
end
|
2476
|
+
|
2477
|
+
# ========================================================================= #
|
2478
|
+
# === return_dataset_from_this_curriculum_file
|
2479
|
+
# ========================================================================= #
|
2480
|
+
def return_dataset_from_this_curriculum_file(i)
|
2481
|
+
return Studium.return_dataset_from_this_curriculum_file(i)
|
2482
|
+
end; alias return_dataset_for_this_curriculum_file return_dataset_from_this_curriculum_file # === return_dataset_for_this_curriculum_file
|
2483
|
+
alias return_dataset_from_this_curriculum return_dataset_from_this_curriculum_file # === return_dataset_from_this_curriculum
|
2484
|
+
alias return_this_curriculum return_dataset_from_this_curriculum_file # === return_this_curriculum
|
2485
|
+
|
2486
|
+
# ========================================================================= #
|
2487
|
+
# === ensure_that_the_log_directory_exists
|
2488
|
+
#
|
2489
|
+
# This method will try to make sure that the log directory exists.
|
2490
|
+
# ========================================================================= #
|
2491
|
+
def ensure_that_the_log_directory_exists
|
2492
|
+
_ = log_dir?
|
2493
|
+
unless File.directory? _
|
2494
|
+
mkdir(_)
|
2495
|
+
end
|
2496
|
+
unless File.directory? "#{_}html/"
|
2497
|
+
mkdir("#{_}html/")
|
2498
|
+
end
|
2499
|
+
end
|
2500
|
+
|
2501
|
+
# ========================================================================= #
|
2502
|
+
# === from_curriculum_id_to_university
|
2503
|
+
#
|
2504
|
+
# This method will translate from the curriculum-ID to the university.
|
2505
|
+
# So it will return a String such as "BOKU".
|
2506
|
+
# ========================================================================= #
|
2507
|
+
def from_curriculum_id_to_university(id)
|
2508
|
+
::Studium.from_curriculum_id_to_university(id)
|
2509
|
+
end; alias from_curriculum_number_to_university from_curriculum_id_to_university # === from_curriculum_number_to_university
|
2510
|
+
alias which_university? from_curriculum_id_to_university # === which_university?
|
2511
|
+
|
2512
|
+
# ========================================================================= #
|
2513
|
+
# === return_name_of_this_curriculum_based_on_its_id_number
|
2514
|
+
#
|
2515
|
+
# The input to this method should be the ID of a curriculum number,
|
2516
|
+
# ideally as a String, such as '033290'.
|
2517
|
+
# ========================================================================= #
|
2518
|
+
def return_name_of_this_curriculum_based_on_its_id_number(i)
|
2519
|
+
::Studium.map_curriculum_number_to_curriculum_name(i)
|
2520
|
+
end; alias from_curriculum_id_to_curriculum_name return_name_of_this_curriculum_based_on_its_id_number # === from_curriculum_id_to_curriculum_name
|
2521
|
+
alias return_curriculum_name_of_this_curriculum_number return_name_of_this_curriculum_based_on_its_id_number # === return_curriculum_name_of_this_curriculum_number
|
2522
|
+
alias curriculum_number_to_curriculum_name return_name_of_this_curriculum_based_on_its_id_number # === curriculum_number_to_curriculum_name
|
2523
|
+
alias name_of_this_curriculum? return_name_of_this_curriculum_based_on_its_id_number # === name_of_this_curriculum?
|
2524
|
+
alias return_name_of_the_curriculum_based_on_this_curriculum_id return_name_of_this_curriculum_based_on_its_id_number # === return_name_of_the_curriculum_based_on_this_curriculum_id
|
2525
|
+
alias return_name_of_the_curriculum return_name_of_this_curriculum_based_on_its_id_number # === return_name_of_the_curriculum
|
2526
|
+
alias turn_id_to_curriculum_name return_name_of_this_curriculum_based_on_its_id_number # === turn_id_to_curriculum_name
|
2527
|
+
|
2528
|
+
# ========================================================================= #
|
2529
|
+
# === return_all_bachelor_lectures
|
2530
|
+
#
|
2531
|
+
# This method will simply return all bachelor-lectures.
|
2532
|
+
# ========================================================================= #
|
2533
|
+
def return_all_bachelor_lectures(
|
2534
|
+
from_this_dataset = ::Studium.main_dataset?
|
2535
|
+
)
|
2536
|
+
if from_this_dataset.nil?
|
2537
|
+
::Studium.initialize_main_dataset
|
2538
|
+
from_this_dataset = ::Studium.main_dataset?
|
2539
|
+
end
|
2540
|
+
from_this_dataset.select {|name_of_the_lecture, inner_hash|
|
2541
|
+
array = inner_hash['curricula']
|
2542
|
+
is_a_bachelor_lecture?(array)
|
2543
|
+
}
|
2544
|
+
end
|
2545
|
+
|
2546
|
+
# ========================================================================= #
|
2547
|
+
# === has_a_bachelor_and_a_master_curriculum?
|
2548
|
+
# ========================================================================= #
|
2549
|
+
def has_a_bachelor_and_a_master_curriculum?(i)
|
2550
|
+
has_a_bachelor_curriculum?(i) and has_a_master_curriculum?(i)
|
2551
|
+
end
|
2552
|
+
|
2553
|
+
# ========================================================================= #
|
2554
|
+
# === available_topics_as_short_name
|
2555
|
+
# ========================================================================= #
|
2556
|
+
def available_topics_as_short_name
|
2557
|
+
::Studium::Exams.all_topics_as_short_name.sort
|
2558
|
+
end; alias available_topics? available_topics_as_short_name # === available_topics?
|
2559
|
+
alias exam_topics? available_topics_as_short_name # === exam_topics?
|
2560
|
+
alias return_all_exam_topics available_topics_as_short_name # === return_all_exam_topics
|
2561
|
+
alias available_exam_topics? available_topics_as_short_name # === available_exam_topics?
|
2562
|
+
|
2563
|
+
# ========================================================================= #
|
2564
|
+
# === return_n_exam_questions_in
|
2565
|
+
#
|
2566
|
+
# This method will return how many exam questions are in the given topic
|
2567
|
+
# xyz.
|
2568
|
+
# ========================================================================= #
|
2569
|
+
def return_n_exam_questions_in(this_topic)
|
2570
|
+
Studium::Exams.return_n_questions_in_this_topic(this_topic)
|
2571
|
+
end
|
2572
|
+
|
2573
|
+
# ========================================================================= #
|
2574
|
+
# === return_lectures_with_at_the_least_one_upcoming_exam
|
2575
|
+
#
|
2576
|
+
# This method will return all lectures that have at the least
|
2577
|
+
# one upcoming exam entry. In this context "upcoming" refers
|
2578
|
+
# to an exam date that comes after today (or any day before
|
2579
|
+
# today).
|
2580
|
+
# ========================================================================= #
|
2581
|
+
def return_lectures_with_at_the_least_one_upcoming_exam
|
2582
|
+
today = Time.now
|
2583
|
+
return_sanitized_dataset_from_the_file_lecture_information.select {|name_of_the_course, hash_dataset|
|
2584
|
+
if hash_dataset.has_key? 'exams'
|
2585
|
+
exams = hash_dataset['exams']
|
2586
|
+
if exams.is_a? Array
|
2587
|
+
exams = exams.first
|
2588
|
+
end
|
2589
|
+
exams = remove_german_weekdays(exams)
|
2590
|
+
exams.delete!(',')
|
2591
|
+
if exams.include? 'Ort:'
|
2592
|
+
exams = exams.split('Ort:').first.to_s
|
2593
|
+
end
|
2594
|
+
# =================================================================== #
|
2595
|
+
# The next line can be problematic, if the entry is incorrect.
|
2596
|
+
# Hence the rescue-clause.
|
2597
|
+
# =================================================================== #
|
2598
|
+
begin
|
2599
|
+
time_parsed = Time.parse(exams)
|
2600
|
+
rescue Exception => error
|
2601
|
+
pp error
|
2602
|
+
e rev+'The original input was: '+
|
2603
|
+
tomato(hash_dataset['exams'])
|
2604
|
+
e 'The modified input was: '+
|
2605
|
+
steelblue(exams)
|
2606
|
+
exit
|
2607
|
+
end
|
2608
|
+
today < time_parsed # Check that the courses are not too old.
|
2609
|
+
else
|
2610
|
+
false
|
2611
|
+
end
|
2612
|
+
}
|
2613
|
+
end
|
2614
|
+
|
2615
|
+
# ========================================================================= #
|
2616
|
+
# === read_dataset_from_a_curriculum_file
|
2617
|
+
# ========================================================================= #
|
2618
|
+
def read_dataset_from_a_curriculum_file(
|
2619
|
+
i,
|
2620
|
+
optional_commands = :remove_comments
|
2621
|
+
)
|
2622
|
+
Studium.read_dataset_from_a_curriculum_file(i, optional_commands)
|
2623
|
+
end
|
2624
|
+
|
2625
|
+
# ========================================================================= #
|
2626
|
+
# === has_a_bachelor_curriculum?
|
2627
|
+
#
|
2628
|
+
# This method will return true if the given Array has any bachelor
|
2629
|
+
# curriculum; and it will return false otherwise.
|
2630
|
+
# ========================================================================= #
|
2631
|
+
def has_a_bachelor_curriculum?(array)
|
2632
|
+
Studium.has_a_bachelor_curriculum?(array)
|
2633
|
+
end; alias has_a_bachelor_curriculum_entry? has_a_bachelor_curriculum? # === has_a_bachelor_curriculum_entry?
|
2634
|
+
alias is_a_bachelor_lecture? has_a_bachelor_curriculum? # === is_a_bachelor_curriculum?
|
2635
|
+
alias is_a_bachelor_curriculum? has_a_bachelor_curriculum? # === is_a_bachelor_curriculum?
|
2636
|
+
alias does_this_include_a_bachelor_curriculum? has_a_bachelor_curriculum? # === does_this_include_a_bachelor_curriculum?
|
2637
|
+
|
2638
|
+
require 'studium/toplevel_methods/map_input_to_this_curriculum_filename.rb'
|
2639
|
+
# ========================================================================= #
|
2640
|
+
# === map_input_to_this_curriculum_filename
|
2641
|
+
# ========================================================================= #
|
2642
|
+
def map_input_to_this_curriculum_filename(i)
|
2643
|
+
::Studium.map_input_to_this_curriculum_filename(i)
|
2644
|
+
end
|
2645
|
+
|
2646
|
+
# ========================================================================= #
|
2647
|
+
# === chmod
|
2648
|
+
#
|
2649
|
+
# The second argument can also be an Array.
|
2650
|
+
# ========================================================================= #
|
2651
|
+
def chmod(
|
2652
|
+
new_mode = 0644,
|
2653
|
+
which_file = 'LINKS.md'
|
2654
|
+
)
|
2655
|
+
FileUtils.chmod(new_mode, which_file)
|
2656
|
+
end
|
2657
|
+
|
2658
|
+
# ========================================================================= #
|
2659
|
+
# === does_this_line_start_with_a_german_weekday?
|
2660
|
+
# ========================================================================= #
|
2661
|
+
def does_this_line_start_with_a_german_weekday?(i)
|
2662
|
+
result = false
|
2663
|
+
if i.include?(' ')
|
2664
|
+
i = i.dup
|
2665
|
+
if i.start_with?(' - "')
|
2666
|
+
i[0, 4] = ''
|
2667
|
+
end
|
2668
|
+
splitted = i.split(' ')
|
2669
|
+
first = splitted.first
|
2670
|
+
if is_german_weekday?(first)
|
2671
|
+
result = true
|
2672
|
+
end
|
2673
|
+
end
|
2674
|
+
return result
|
2675
|
+
end
|
2676
|
+
|
2677
|
+
# ========================================================================= #
|
2678
|
+
# === return_either_grey_or_the_custom_colour_for_answers
|
2679
|
+
# ========================================================================= #
|
2680
|
+
def return_either_grey_or_the_custom_colour_for_answers
|
2681
|
+
_ = grey('').strip
|
2682
|
+
if @internal_hash[:custom_colours] and
|
2683
|
+
@internal_hash[:custom_colours].has_key?('colour_for_answers')
|
2684
|
+
_ = COLOURS.send(@internal_hash[:custom_colours]['colour_for_answers']) { :omit_end }
|
2685
|
+
end
|
2686
|
+
return _
|
2687
|
+
end
|
2688
|
+
|
2689
|
+
# ========================================================================= #
|
2690
|
+
# === studium_log_dir?
|
2691
|
+
#
|
2692
|
+
# This is the log dir - where we "operate on".
|
2693
|
+
# ========================================================================= #
|
2694
|
+
def studium_log_dir?
|
2695
|
+
Studium.log_dir?
|
2696
|
+
end; alias log_dir? studium_log_dir? # === log_dir?
|
2697
|
+
alias base_dir? studium_log_dir? # === base_dir?
|
2698
|
+
|
2699
|
+
# ========================================================================= #
|
2700
|
+
# === return_hour_from_this
|
2701
|
+
#
|
2702
|
+
# This method will extract the time-format from a String,
|
2703
|
+
# such as:
|
2704
|
+
#
|
2705
|
+
# "18.02.2020, 17:00-18:00"
|
2706
|
+
# "Dienstag 13.10.2020, 14:30-17:45"
|
2707
|
+
#
|
2708
|
+
# A String will be returned in this event, holding the start and
|
2709
|
+
# stop time - for instance, in the first example it would return
|
2710
|
+
# the String "17:00-18:00".
|
2711
|
+
#
|
2712
|
+
# A String should be given as argument to this method.
|
2713
|
+
# ========================================================================= #
|
2714
|
+
def return_hour_from_this(i)
|
2715
|
+
i.scan(
|
2716
|
+
/\d{2}:\d{2}-\d{2}:\d{2}/
|
2717
|
+
).flatten.first.to_s.strip
|
2718
|
+
end; alias extract_the_time_from return_hour_from_this # === extract_the_time
|
2719
|
+
|
2720
|
+
# ========================================================================= #
|
2721
|
+
# === sort_these_lecture_names_by_time
|
2722
|
+
# ========================================================================= #
|
2723
|
+
def sort_these_lecture_names_by_time(
|
2724
|
+
array, weekday
|
2725
|
+
)
|
2726
|
+
_ = main_dataset?
|
2727
|
+
array.sort_by {|entry|
|
2728
|
+
pointer = _[entry]
|
2729
|
+
lva_date = pointer['lva_dates'].select {|inner_entry|
|
2730
|
+
inner_entry.include? weekday
|
2731
|
+
}
|
2732
|
+
lva_date = lva_date.first if lva_date.is_a? Array
|
2733
|
+
lva_date = return_hour_from_this(lva_date) # This will be like "08:00-09:45"
|
2734
|
+
# ===================================================================== #
|
2735
|
+
# However had, we only need the last part, so chop it down.
|
2736
|
+
# ===================================================================== #
|
2737
|
+
if lva_date.include? '-'
|
2738
|
+
lva_date = lva_date.split('-').first
|
2739
|
+
end
|
2740
|
+
timestamp = Time.parse(lva_date)
|
2741
|
+
timestamp # And "return" it here.
|
2742
|
+
}
|
2743
|
+
end
|
2744
|
+
|
2745
|
+
# ========================================================================= #
|
2746
|
+
# === number_to_month
|
2747
|
+
#
|
2748
|
+
# This method will convert a number, such as 6, to the corresponding
|
2749
|
+
# month entry.
|
2750
|
+
# ========================================================================= #
|
2751
|
+
def number_to_month(i)
|
2752
|
+
array = Date::MONTHNAMES
|
2753
|
+
i = i.to_i
|
2754
|
+
return array[i]
|
2755
|
+
end
|
2756
|
+
|
2757
|
+
# ========================================================================= #
|
2758
|
+
# === return_hh_mm_ss_from
|
2759
|
+
#
|
2760
|
+
# Input to this method may be like this:
|
2761
|
+
#
|
2762
|
+
# 2020-03-04 00:00:00 +0000
|
2763
|
+
#
|
2764
|
+
# It will then return the ss:mm:hh notation.
|
2765
|
+
# ========================================================================= #
|
2766
|
+
def return_hh_mm_ss_from(i = Time.now)
|
2767
|
+
if i.is_a? String
|
2768
|
+
i = Time.parse(i)
|
2769
|
+
end
|
2770
|
+
if i.is_a? Time
|
2771
|
+
"#{i.hour.to_s.rjust(2,'0')}:"\
|
2772
|
+
"#{i.min.to_s.rjust(2,'0')}:"\
|
2773
|
+
"#{i.sec.to_s.rjust(2,'0')}"
|
2774
|
+
else
|
2775
|
+
e 'Unknown time format.'
|
2776
|
+
end
|
2777
|
+
end; alias hh_mm_ss return_hh_mm_ss_from # === hh_mm_ss
|
2778
|
+
|
2779
|
+
# ========================================================================= #
|
2780
|
+
# === datum?
|
2781
|
+
# ========================================================================= #
|
2782
|
+
def datum?
|
2783
|
+
Studium.datum? # ← Available in "studium/toplevel_methods/time.rb".
|
2784
|
+
end
|
2785
|
+
|
2786
|
+
# ========================================================================= #
|
2787
|
+
# === this_month_has_n_days?
|
2788
|
+
#
|
2789
|
+
# This method will return the maximum amount of days in the given
|
2790
|
+
# month.
|
2791
|
+
# ========================================================================= #
|
2792
|
+
def this_month_has_n_days?(
|
2793
|
+
this_month,
|
2794
|
+
this_year = Time.now.year
|
2795
|
+
)
|
2796
|
+
this_month = this_month.to_i
|
2797
|
+
return 29 if this_month == 2 && Date.gregorian_leap?(this_year)
|
2798
|
+
COMMON_YEAR_DAYS_IN_MONTH[this_month]
|
2799
|
+
end
|
2800
|
+
|
2801
|
+
# ========================================================================= #
|
2802
|
+
# === return_n_days_until_sunday
|
2803
|
+
# ========================================================================= #
|
2804
|
+
def return_n_days_until_sunday(
|
2805
|
+
time_now = Time.now
|
2806
|
+
)
|
2807
|
+
n_days_difference_from_today_to_this_day(time_now, 'Sunday')
|
2808
|
+
end
|
2809
|
+
|
2810
|
+
# ========================================================================= #
|
2811
|
+
# === return_current_year
|
2812
|
+
#
|
2813
|
+
# This method will simply return the current year, as String.
|
2814
|
+
# ========================================================================= #
|
2815
|
+
def return_current_year
|
2816
|
+
Time.now.year.to_s
|
2817
|
+
end; alias current_year? return_current_year # === current_year?
|
2818
|
+
|
2819
|
+
# ========================================================================= #
|
2820
|
+
# === return_dd_mm_yy_and_time_from
|
2821
|
+
#
|
2822
|
+
# This method will return the day, in dd.mm.yyyy format, and the
|
2823
|
+
# time on that date. You have to pass in a special object to this
|
2824
|
+
# method, such as an instance of class Time - see methods used
|
2825
|
+
# such as .day() or .month() and so forth.
|
2826
|
+
# ========================================================================= #
|
2827
|
+
def return_dd_mm_yy_and_time_from(i)
|
2828
|
+
Studium.return_dd_mm_yy_and_time_from(i)
|
2829
|
+
end
|
2830
|
+
|
2831
|
+
# ========================================================================= #
|
2832
|
+
# === current_semester?
|
2833
|
+
#
|
2834
|
+
# This method will either return the Symbol :summer or it will return
|
2835
|
+
# the Symbol :winter. This will be based on the current time (today).
|
2836
|
+
# ========================================================================= #
|
2837
|
+
def current_semester?
|
2838
|
+
today = ::Time.now
|
2839
|
+
# ======================================================================= #
|
2840
|
+
# Next we must determine whether we have the Range in winter or the
|
2841
|
+
# Range in summer.
|
2842
|
+
# ======================================================================= #
|
2843
|
+
current_year = current_year?.to_i
|
2844
|
+
next_year = current_year+1
|
2845
|
+
winter_range = ( Date.parse('01.10.'+current_year.to_s) .. Date.parse('28.02.'+next_year.to_s) )
|
2846
|
+
min_winter_day = winter_range.min
|
2847
|
+
max_winter_day = winter_range.max
|
2848
|
+
summer_range = ( Date.parse('01.03.'+current_year.to_s) .. Date.parse('30.09.'+current_year.to_s) )
|
2849
|
+
min_summer_day = summer_range.min
|
2850
|
+
max_summer_day = summer_range.max
|
2851
|
+
# ======================================================================= #
|
2852
|
+
# Ok, we have all the required dates. Now we have to check on the variable
|
2853
|
+
# today to find out in which range we are in.
|
2854
|
+
# ======================================================================= #
|
2855
|
+
if min_winter_day <= today.to_datetime and max_winter_day >= today.to_datetime
|
2856
|
+
# e 'Yes, the queried date is part of the date-range.'
|
2857
|
+
:winter
|
2858
|
+
else
|
2859
|
+
# e 'No, the queried date is NOT part of the date-range.'
|
2860
|
+
if min_summer_day <= today.to_datetime and max_summer_day >= today.to_datetime
|
2861
|
+
:summer
|
2862
|
+
else
|
2863
|
+
:impossible_situation_check_for_flaw_in_the_code
|
2864
|
+
end
|
2865
|
+
end
|
2866
|
+
end
|
2867
|
+
|
2868
|
+
# ========================================================================= #
|
2869
|
+
# === day_month_year
|
2870
|
+
#
|
2871
|
+
# This method will return a dd.mm.yyyy notation.
|
2872
|
+
#
|
2873
|
+
# If you need to find out whether the given input-day is today, then
|
2874
|
+
# use the method called .is_this_day_today?, defined in this file.
|
2875
|
+
#
|
2876
|
+
# An example for this will be:
|
2877
|
+
#
|
2878
|
+
# 03.04.2020
|
2879
|
+
#
|
2880
|
+
# ========================================================================= #
|
2881
|
+
def day_month_year(
|
2882
|
+
use_this_time = Time.now
|
2883
|
+
)
|
2884
|
+
if use_this_time.is_a? Time
|
2885
|
+
use_this_time.strftime('%d.%m.%Y')
|
2886
|
+
else
|
2887
|
+
use_this_time
|
2888
|
+
end
|
2889
|
+
end; alias today? day_month_year # === today?
|
2890
|
+
alias return_day_month_year day_month_year # === return_day_month_year
|
2891
|
+
alias dd_mm_yyyy day_month_year # === dd_mm_yyyy
|
2892
|
+
alias return_dd_mm_yyyy day_month_year # === return_dd_mm_yyyy
|
2893
|
+
alias time_today day_month_year # === time_today
|
2894
|
+
|
2895
|
+
# ========================================================================= #
|
2896
|
+
# === parse_dd_mm_yyyy
|
2897
|
+
# ========================================================================= #
|
2898
|
+
def parse_dd_mm_yyyy(
|
2899
|
+
i = '03.05.2023'
|
2900
|
+
)
|
2901
|
+
if i.is_a? String
|
2902
|
+
if i.include? ' '
|
2903
|
+
i = i.split(' ').last.to_s.strip
|
2904
|
+
end
|
2905
|
+
return ::Time.parse(i)
|
2906
|
+
else
|
2907
|
+
return i
|
2908
|
+
end
|
2909
|
+
end
|
2910
|
+
|
2911
|
+
# ========================================================================= #
|
2912
|
+
# === is_this_day_today?
|
2913
|
+
#
|
2914
|
+
# This method will return true or false, depending on whether the given
|
2915
|
+
# input is assumed to be the present day or not.
|
2916
|
+
#
|
2917
|
+
# The method assumes that the input will be a Time object normally.
|
2918
|
+
# ========================================================================= #
|
2919
|
+
def is_this_day_today?(
|
2920
|
+
i = '18.02.2022'
|
2921
|
+
)
|
2922
|
+
dd_mm_yyyy(Time.now) == dd_mm_yyyy(i)
|
2923
|
+
end
|
2924
|
+
|
2925
|
+
# ========================================================================= #
|
2926
|
+
# === weekday?
|
2927
|
+
#
|
2928
|
+
# This method will return a String such as "Thursday". Note that the
|
2929
|
+
# english name will be returned by default. This can be changed via
|
2930
|
+
# the second parameter to this method, which can be either :english
|
2931
|
+
# or :german.
|
2932
|
+
#
|
2933
|
+
# The input to this method should be a number, such as can be obtained
|
2934
|
+
# via the method .wday().
|
2935
|
+
#
|
2936
|
+
# A String can also be passed into this method, in a form like
|
2937
|
+
# "dd.mm.yyyy". So, an input String such as "10.03.2018" is
|
2938
|
+
# perfectly valid.
|
2939
|
+
# ========================================================================= #
|
2940
|
+
def weekday?(
|
2941
|
+
i = Date.today.wday,
|
2942
|
+
use_this_language = :english
|
2943
|
+
)
|
2944
|
+
if i.is_a?(String) and i.include?('.')
|
2945
|
+
# ===================================================================== #
|
2946
|
+
# In this case here assume an input-String such as "12.03.2018".
|
2947
|
+
# ===================================================================== #
|
2948
|
+
begin
|
2949
|
+
i = Time.parse(i).wday
|
2950
|
+
rescue ArgumentError => error
|
2951
|
+
pp error
|
2952
|
+
end
|
2953
|
+
end
|
2954
|
+
result = Date::DAYNAMES[i]
|
2955
|
+
case use_this_language
|
2956
|
+
# ======================================================================= #
|
2957
|
+
# === :german
|
2958
|
+
# ======================================================================= #
|
2959
|
+
when :german,
|
2960
|
+
:use_german
|
2961
|
+
# ===================================================================== #
|
2962
|
+
# In this case we have to translate to the german name.
|
2963
|
+
# ===================================================================== #
|
2964
|
+
result = ENGLISH_TO_GERMAN_WEEKDAYS[result]
|
2965
|
+
end
|
2966
|
+
return result
|
2967
|
+
end; alias return_name_for_this_day weekday? # === return_name_for_this_day
|
2968
|
+
alias return_weekday_for weekday? # === return_weekday_for
|
2969
|
+
alias return_weekday_of weekday? # === return_weekday_of
|
2970
|
+
alias return_weekday_from_this_input weekday? # === return_weekday_from_this_input
|
2971
|
+
alias english_weekday weekday? # === english_weekday
|
2972
|
+
alias english_weekday? weekday? # === english_weekday?
|
2973
|
+
|
2974
|
+
# ========================================================================= #
|
2975
|
+
# === open_in_browser
|
2976
|
+
# ========================================================================= #
|
2977
|
+
def open_in_browser(i)
|
2978
|
+
try_to_require_the_open_gem unless Object.const_defined?(:Open)
|
2979
|
+
Open.in_browser(i)
|
2980
|
+
end
|
2981
|
+
|
2982
|
+
# ========================================================================= #
|
2983
|
+
# === require_open_uri
|
2984
|
+
# ========================================================================= #
|
2985
|
+
def require_open_uri
|
2986
|
+
require 'open-uri'
|
2987
|
+
end
|
2988
|
+
|
2989
|
+
# ========================================================================= #
|
2990
|
+
# === write_what_into
|
2991
|
+
#
|
2992
|
+
# Use this method to save data into a specific file.
|
2993
|
+
# ========================================================================= #
|
2994
|
+
def write_what_into(
|
2995
|
+
what,
|
2996
|
+
into,
|
2997
|
+
&block
|
2998
|
+
)
|
2999
|
+
Studium.write_what_into(what, into, &block)
|
3000
|
+
end; alias store_what_into write_what_into # === store_what_into
|
3001
|
+
|
3002
|
+
# ========================================================================= #
|
3003
|
+
# === return_either_grey_or_the_custom_colour_for_questions
|
3004
|
+
# ========================================================================= #
|
3005
|
+
def return_either_grey_or_the_custom_colour_for_questions(
|
3006
|
+
custom_colours = @internal_hash[:custom_colours]
|
3007
|
+
)
|
3008
|
+
_ = grey('').strip
|
3009
|
+
if custom_colours and
|
3010
|
+
custom_colours.has_key?('colour_for_questions')
|
3011
|
+
_ = COLOURS.send(custom_colours['colour_for_questions']) { :omit_end }
|
3012
|
+
end
|
3013
|
+
return _
|
3014
|
+
end
|
3015
|
+
|
3016
|
+
# ========================================================================= #
|
3017
|
+
# === dataset?
|
3018
|
+
#
|
3019
|
+
# This query-method won't be valid for all subclasses, but I consider it
|
3020
|
+
# useful to have it enabled by default - that way we can avoid having
|
3021
|
+
# to define it for those subclasses that make use of it.
|
3022
|
+
# ========================================================================= #
|
3023
|
+
def dataset?
|
3024
|
+
@internal_hash[:dataset]
|
3025
|
+
end
|
3026
|
+
|
3027
|
+
# ========================================================================= #
|
3028
|
+
# === course_filter
|
3029
|
+
#
|
3030
|
+
# This method is a generic filter over the dataset made available in
|
3031
|
+
# the file lecture_information.yml.
|
3032
|
+
# ========================================================================= #
|
3033
|
+
def course_filter(
|
3034
|
+
dataset = dataset?,
|
3035
|
+
filter_how = :BOKU
|
3036
|
+
)
|
3037
|
+
act_on_this_entry = :university
|
3038
|
+
case filter_how
|
3039
|
+
# ======================================================================= #
|
3040
|
+
# === :winter
|
3041
|
+
# ======================================================================= #
|
3042
|
+
when :winter
|
3043
|
+
act_on_this_entry = :semester
|
3044
|
+
# ======================================================================= #
|
3045
|
+
# === :prüfungsimmanent
|
3046
|
+
# ======================================================================= #
|
3047
|
+
when :prüfungsimmanent
|
3048
|
+
act_on_this_entry = :type
|
3049
|
+
end
|
3050
|
+
return dataset.select {|name_of_the_course, inner_hash|
|
3051
|
+
case act_on_this_entry
|
3052
|
+
# ===================================================================== #
|
3053
|
+
# === :type
|
3054
|
+
# ===================================================================== #
|
3055
|
+
when :type
|
3056
|
+
case filter_how
|
3057
|
+
# =================================================================== #
|
3058
|
+
# === :prüfungsimmanent
|
3059
|
+
# =================================================================== #
|
3060
|
+
when :prüfungsimmanent
|
3061
|
+
_ = inner_hash[act_on_this_entry]
|
3062
|
+
is_prüfungsimmanent?(_)
|
3063
|
+
else
|
3064
|
+
false
|
3065
|
+
end
|
3066
|
+
# ===================================================================== #
|
3067
|
+
# === :semester
|
3068
|
+
# ===================================================================== #
|
3069
|
+
when :semester
|
3070
|
+
_ = inner_hash[act_on_this_entry]
|
3071
|
+
if _
|
3072
|
+
_.to_sym == filter_how # e. g. == :winter
|
3073
|
+
else
|
3074
|
+
e 'nil-entry for '+name_of_the_course+' - please fix this.'
|
3075
|
+
end
|
3076
|
+
# ===================================================================== #
|
3077
|
+
# === :university
|
3078
|
+
# ===================================================================== #
|
3079
|
+
when :university
|
3080
|
+
inner_hash[act_on_this_entry].to_sym == filter_how
|
3081
|
+
end
|
3082
|
+
}
|
3083
|
+
end
|
3084
|
+
|
3085
|
+
# ========================================================================= #
|
3086
|
+
# === return_n_days_until_monday
|
3087
|
+
# ========================================================================= #
|
3088
|
+
def return_n_days_until_monday(
|
3089
|
+
time_now = Time.now
|
3090
|
+
)
|
3091
|
+
n_days_difference_from_today_to_this_day(time_now, 'Monday')
|
3092
|
+
end
|
3093
|
+
|
3094
|
+
# ========================================================================= #
|
3095
|
+
# === n_seconds_to_n_days
|
3096
|
+
#
|
3097
|
+
# A day has 60 seconds * 60 minutes
|
3098
|
+
# ========================================================================= #
|
3099
|
+
def n_seconds_to_n_days(i)
|
3100
|
+
hour = 60 * 60.0
|
3101
|
+
one_day = hour * 24
|
3102
|
+
return (i / one_day.to_f)
|
3103
|
+
end
|
3104
|
+
|
3105
|
+
# ========================================================================= #
|
3106
|
+
# === readlines_from_this_input_file
|
3107
|
+
#
|
3108
|
+
# This method is essentially File.readlines(), but we also use the
|
3109
|
+
# :encoding symbol to denote which Encoding to use.
|
3110
|
+
#
|
3111
|
+
# As first argument pass in the file path to the target input file.
|
3112
|
+
#
|
3113
|
+
# You should ideally use this method in a unified way, that is, whenever
|
3114
|
+
# you want to read the content of a file make use of this method here.
|
3115
|
+
# This makes it easier to have the functionality all in one place.
|
3116
|
+
#
|
3117
|
+
# Keep in mind that the file in question has to exist locally; the
|
3118
|
+
# file here will NOT check whether the given input file exists.
|
3119
|
+
# ========================================================================= #
|
3120
|
+
def readlines_from_this_input_file(
|
3121
|
+
this_file,
|
3122
|
+
use_this_encoding = :default_encoding,
|
3123
|
+
&block
|
3124
|
+
)
|
3125
|
+
yielded = nil
|
3126
|
+
if block_given?
|
3127
|
+
yielded = yield
|
3128
|
+
end
|
3129
|
+
case use_this_encoding
|
3130
|
+
# ======================================================================= #
|
3131
|
+
# === :default
|
3132
|
+
#
|
3133
|
+
# This refers to the default encoding, which is usually UTF-8 (Unicode).
|
3134
|
+
# ======================================================================= #
|
3135
|
+
when :default,
|
3136
|
+
:default_encoding
|
3137
|
+
use_this_encoding = ::Studium.main_encoding?
|
3138
|
+
end
|
3139
|
+
if use_this_encoding.is_a? Hash
|
3140
|
+
# ===================================================================== #
|
3141
|
+
# === :encoding
|
3142
|
+
# ===================================================================== #
|
3143
|
+
if use_this_encoding.has_key? :encoding
|
3144
|
+
use_this_encoding = use_this_encoding[:encoding]
|
3145
|
+
end
|
3146
|
+
end
|
3147
|
+
if this_file
|
3148
|
+
if this_file.is_a? Array
|
3149
|
+
return this_file.map {|inner_entry|
|
3150
|
+
if File.exist?(inner_entry)
|
3151
|
+
inner_entry = File.readlines(inner_entry, encoding: use_this_encoding)
|
3152
|
+
end
|
3153
|
+
inner_entry
|
3154
|
+
}.flatten
|
3155
|
+
elsif File.exist?(this_file)
|
3156
|
+
return File.readlines(
|
3157
|
+
this_file,
|
3158
|
+
encoding: use_this_encoding
|
3159
|
+
)
|
3160
|
+
end
|
3161
|
+
else
|
3162
|
+
unless yielded == :be_quiet
|
3163
|
+
e "Can not read in the file at #{this_file} as it does not exist."
|
3164
|
+
end
|
3165
|
+
return false
|
3166
|
+
end
|
3167
|
+
end; alias readlines_via_default_encoding readlines_from_this_input_file # === readlines_via_default_encoding
|
3168
|
+
alias readlines_with_default_encoding readlines_from_this_input_file # === readlines_with_default_encoding
|
3169
|
+
alias readlines_with_the_default_encoding readlines_from_this_input_file # === readlines_with_the_default_encoding
|
3170
|
+
alias file_readlines_of_this_file readlines_from_this_input_file # === file_readlines_of_this_file
|
3171
|
+
alias file_readlines readlines_from_this_input_file # === file_readlines
|
3172
|
+
alias readlines_with_proper_encoding readlines_from_this_input_file # === readlines_with_proper_encoding
|
3173
|
+
alias proper_readlines readlines_from_this_input_file # === proper_readlines
|
3174
|
+
alias default_readlines readlines_from_this_input_file # === default_readlines
|
3175
|
+
alias readlines readlines_from_this_input_file # === readlines
|
3176
|
+
# alias readlines_with_iso_encoding readlines_from_this_input_file # === readlines_with_iso_encoding
|
3177
|
+
|
3178
|
+
# ========================================================================= #
|
3179
|
+
# === find_corresponding_exam_topic
|
3180
|
+
#
|
3181
|
+
# This method will try to find the corresponding exam topic, based on a
|
3182
|
+
# short given input.
|
3183
|
+
#
|
3184
|
+
# For instance, 'bem1' will become 'basic biochemistry' and 'amg1'
|
3185
|
+
# will become 'allgemeine_genetik'. If no match is found then the
|
3186
|
+
# original input will be returned.
|
3187
|
+
# ========================================================================= #
|
3188
|
+
def find_corresponding_exam_topic(
|
3189
|
+
i,
|
3190
|
+
be_verbose = be_verbose?
|
3191
|
+
)
|
3192
|
+
return Studium.find_corresponding_exam_topic(i, be_verbose)
|
3193
|
+
end; alias return_file_associated_with_this_exam_topic find_corresponding_exam_topic # === return_file_associated_with_this_exam_topic
|
3194
|
+
alias find_corresponding_exam_title find_corresponding_exam_topic # === find_corresponding_exam_title
|
3195
|
+
alias expand_topic find_corresponding_exam_topic # === expand_topic
|
3196
|
+
alias try_to_find_a_registered_exam_topic find_corresponding_exam_topic # === try_to_find_a_registered_exam_topic
|
3197
|
+
|
3198
|
+
# ========================================================================= #
|
3199
|
+
# === is_this_a_registered_exam_topic?
|
3200
|
+
#
|
3201
|
+
# This method must return a boolean - true if the given input is a
|
3202
|
+
# registere exam topic; and false otherwise.
|
3203
|
+
# ========================================================================= #
|
3204
|
+
def is_this_a_registered_exam_topic?(i)
|
3205
|
+
original_input = i.dup
|
3206
|
+
possibly_expanded_input = try_to_find_a_registered_exam_topic(original_input)
|
3207
|
+
return original_input == possibly_expanded_input
|
3208
|
+
end
|
3209
|
+
|
3210
|
+
end; end
|
3211
|
+
|
3212
|
+
if __FILE__ == $PROGRAM_NAME
|
3213
|
+
require 'verbose_truth'
|
3214
|
+
alias e puts
|
3215
|
+
x = Studium::Base.new
|
3216
|
+
# x.current_semester? # This will be :winter or :summer.
|
3217
|
+
e x.this_month_has_n_days?('10')
|
3218
|
+
e x.this_month_has_n_days?('11')
|
3219
|
+
e x.this_month_has_n_days?('12')
|
3220
|
+
e 'Do we have konsole support? '+
|
3221
|
+
VerboseTruth[
|
3222
|
+
x.konsole_support?.to_s
|
3223
|
+
]
|
3224
|
+
p x.web_liner
|
3225
|
+
Studium::Base.new.directory_to_the_exam_topics?
|
3226
|
+
p base.weekday?
|
3227
|
+
p base.today?
|
3228
|
+
p base.select_lectures_with_this_key(:exam_registration_at)
|
3229
|
+
end
|