From 1cce8fe30a73f538ed63e88d7c09e18456d333b9 Mon Sep 17 00:00:00 2001
From: Hong-Phuc Bui <hong-phuc.bui@htwsaar.de>
Date: Wed, 19 Jun 2024 10:01:45 +0200
Subject: [PATCH] test

---
 study-effort/src/mystudy/main.py |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/study-effort/src/mystudy/main.py b/study-effort/src/mystudy/main.py
index d5d8a94..f90d7d9 100644
--- a/study-effort/src/mystudy/main.py
+++ b/study-effort/src/mystudy/main.py
@@ -1,12 +1,21 @@
-from mystudy import lecture
+from mystudy.lecture import Lecture, parse_lecture_line
+from sys import argv
 
-lecture_count = input("Geben Sie die Anzahl der Veranstaltungen ein!")
-lecture_per_week = int(lecture_count)
 
-ects_input = input("Geben Sie die ECTS-Zahl der Vorlesung ein!")
-ects = int(ects_input)
+def read_file_to_lecture(filename: str) -> list[Lecture]:
+    lectures = []
+    with open(filename, 'r') as file:
+        while line := file.readline():
+            if len(line.strip()) > 0:
+                l = parse_lecture_line(line)
+                lectures.append(l)
+    return lectures
 
-effort = lecture.lecture_effort(lecture_per_week, ects)
-text = lecture.format_lecture_effort("Mathematik", lecture_per_week, ects, effort)
 
-print(text)
+def main():
+    filename = argv[1]
+    print(filename)
+    lectures = read_file_to_lecture(filename)
+    for l in lectures:
+        print(l)
+

--
Gitblit v1.10.0-SNAPSHOT