import {DomOutput} from "./lib/DomIO.js"; import {calculateHomeworkTime} from "./study.js"; const OUTPUT_ELEMENT_ID = "text-output"; let terminal = new DomOutput(OUTPUT_ELEMENT_ID); document.addEventListener("DOMContentLoaded",() =>{ document.getElementById("run").addEventListener("click", main); }); function main() { let lectures = [ // ergänzen Sie die Vorlesungen hier. Die Struktur des Elementes finden Sie im Skript ]; let lecturesInformation = [] for(let lecture of lectures ) { let homework = calculateHomeworkTime(lecture.ects, lecture.sws/2); let newLecture = Object.assign({},lecture); newLecture.homework = homework; lecturesInformation.push(newLecture); } printLectureInformation(lecturesInformation); } /** * pint a HTML table which represents the erffort of each lecture, one per row, * on browser via `terminal`. * * @param lecturesInformation an array, its elements have structure: * ```[ * {"name":"Deutsch 3", "code":"DFBI-311", "sws":4, "ects": 4, "homework": 1}, * {"name":"Französisch 3", "code":"DFBI-312", "sws":3, "ects": 4, "homework": 1} * ]``` * * */ function printLectureInformation(lecturesInformation) { terminal.clear(); let table = `\n`; for(let l of lecturesInformation) { table += `\n` } table += "
VorlesungAufwand pro Woche in Stunden
${l.name} ${l.homework}
"; terminal.printh(table); }