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/lecture.py | 51 ++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/study-effort/src/mystudy/lecture.py b/study-effort/src/mystudy/lecture.py
index 778a4bb..b6861de 100644
--- a/study-effort/src/mystudy/lecture.py
+++ b/study-effort/src/mystudy/lecture.py
@@ -4,19 +4,48 @@
ects_effort: Final[int] = 30
-def lecture_effort(lecture_pre_week, ects):
- """
- :param lecture_pre_week: wie viel Veranstaltungen hat eine Vorlesung in der Woche
- :param ects: Anzahl der ECTS der Vorlesung
- :return:
- """
- effort_in_time = ects * ects_effort
- effort_per_week = effort_in_time / lecture_time # how many hours for a week
- return effort_per_week - (lecture_pre_week * 1.5)
+class Lecture():
+ def __init__(self, name, ects, frequency):
+ """
+
+ :param name:
+ :param ects:
+ :param frequency:
+ """
+ self._name = name
+ self._ects = ects
+ self._frequency = frequency
+
+ def cal_effort(self, time_per_ects = ects_effort, duration = lecture_time) -> float:
+ """
+ Berechnet den Zeitaufwand pro woche für diese Vorlesung
+ :param time_per_ects:
+ :param duration:
+ :return:
+ """
+ effort_in_time = self._ects * time_per_ects
+ effort_per_week = effort_in_time / duration
+ return effort_per_week - (self._frequency * 1.5)
+
+ def __repr__(self):
+ return f"Vorlesungsname {self._name} ECTS: {self._ects}"
+
+ # def __str__(self):
+ # return self.__repr__()
-def format_lecture_effort(name, lecture_count, ects, effort):
- return f"Für die Vorlesung {name} mit {ects} ECTS und {lecture_count} Veranstaltung pro Woche brauchen Sie {effort} Stunden zu lernen."
+def parse_lecture_line(line: str) -> Lecture:
+ words = line.split(";")
+ words = [w.strip() for w in words]
+ name = words[0]
+ count = float(words[1])
+ ects = int(words[2])
+ return Lecture(name, ects, count)
+ pass
+
+
+
+
--
Gitblit v1.10.0