From 93cf2ecfdc9ba8ae8513676c31ee882f4173565f Mon Sep 17 00:00:00 2001 From: lade043 <48773751+lade043@users.noreply.github.com> Date: Tue, 30 Jul 2019 16:55:26 +0200 Subject: [PATCH 1/8] Update user_IO.py --- user_IO.py | 1 - 1 file changed, 1 deletion(-) diff --git a/user_IO.py b/user_IO.py index 7fcc4d1..4fa37a9 100644 --- a/user_IO.py +++ b/user_IO.py @@ -1,5 +1,4 @@ def user_input(): - print("Hi User, \n do you want to edit your grades?") todo = input("Ok, do you want to see them or to edit them? [see/edit]\n") if todo == "see": print("Which subject do you want to know the information?") -- 2.39.5 From 55a1e7c9b998c9b9459aceec134f8909134b2392 Mon Sep 17 00:00:00 2001 From: tstst334 Date: Tue, 30 Jul 2019 07:56:44 -0700 Subject: [PATCH 2/8] add main --- main.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..e69de29 -- 2.39.5 From 4ae91748d14b8c84fc84048c0952430c29eb4bb1 Mon Sep 17 00:00:00 2001 From: Lars Bogner Date: Tue, 30 Jul 2019 17:01:40 +0200 Subject: [PATCH 3/8] edited class subject and grade --- subject.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subject.py b/subject.py index 6e19562..dda4c0d 100644 --- a/subject.py +++ b/subject.py @@ -20,6 +20,17 @@ class Subject: def return_grade_categories(self): return [i for i in self.grades] + def return_average_of_category(self, category): + return sum(self.grades[category][0]) / len(self.grades[category][0]) + + def return_average_of_subject(self): + rating_sum = 0 + grade_sum = 0 + for i in self.grades: + rating_sum += self.grades[i][1] + grade_sum += self.return_average_of_category(i) + return grade_sum / rating_sum + class Grade: def __init__(self, grade, name, date=str(str_date.now())): -- 2.39.5 From 44a5fbc4b7961a5635f7dc071f9683168f0c1403 Mon Sep 17 00:00:00 2001 From: Lars Bogner Date: Wed, 31 Jul 2019 16:38:47 +0200 Subject: [PATCH 4/8] started main and fixed issue #7 --- main.py | 11 +++++++++++ subject.py | 7 +++++++ user_IO.py | 6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index e69de29..b340ca6 100644 --- a/main.py +++ b/main.py @@ -0,0 +1,11 @@ +import subject +import user_IO + +subjects = [] +while True: + user_input = user_IO.user_input() + if user_input[0] == "input": + if user_input[1] == "grade": + subject_edit = subject.get_subject(subjects, user_input[2]) + if subject_edit: + subject_edit.add_grade(user_input[3], subject.Grade(user_input[4], user_input[5])) diff --git a/subject.py b/subject.py index 6e19562..9935cbe 100644 --- a/subject.py +++ b/subject.py @@ -26,3 +26,10 @@ class Grade: self.grade = grade self.name = name self.date = date + + +def get_subject(liste, name): + for subject in liste: + if subject.name == name: + return subject + return None diff --git a/user_IO.py b/user_IO.py index 7fcc4d1..3595133 100644 --- a/user_IO.py +++ b/user_IO.py @@ -10,15 +10,15 @@ def user_input(): user_add = input() if user_add == "subject": subject = input("Which subject do you want to add? \n") - return "input", subject + return "input", "subject", subject elif user_add == "category": subject = input("To which subject do you want to add the category? \n") category = input("Which category do you want to add? \n") rating = float(input("Rating? \n")) - return "input", subject, category, rating + return "input", "category", subject, category, rating elif user_add == "grade": subject = input("To which subject do you want to add the grade? \n") category = input("To which category do you want to add it? \n") grade = input("Grade? \n") grade_name = input("What's the name of the grade? \n") - return "input", subject, category, grade, grade_name + return "input", "grade", subject, category, grade, grade_name -- 2.39.5 From ad2fad6b292993030d62bb90a09e350cb7f99b31 Mon Sep 17 00:00:00 2001 From: Lars Bogner Date: Wed, 31 Jul 2019 19:36:22 +0200 Subject: [PATCH 5/8] error handling (issue n#9) --- main.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index b340ca6..209796f 100644 --- a/main.py +++ b/main.py @@ -2,10 +2,21 @@ import subject import user_IO subjects = [] -while True: - user_input = user_IO.user_input() - if user_input[0] == "input": - if user_input[1] == "grade": - subject_edit = subject.get_subject(subjects, user_input[2]) - if subject_edit: - subject_edit.add_grade(user_input[3], subject.Grade(user_input[4], user_input[5])) +try: + while True: + user_input = user_IO.user_input() + if user_input[0] == "input": + if user_input[1] == "grade": + subject_edit = subject.get_subject(subjects, user_input[2]) + if subject_edit: + subject_edit.add_grade(user_input[3], subject.Grade(user_input[4], user_input[5])) + elif user_input[1] == "category": + subject_edit = subject.get_subject(subjects, user_input[2]) + if subject_edit: + subject_edit.add_grade_category(user_input[3], user_input[4]) + elif user_input[1] == "subject": + subjects.append(subject.Subject(user_input[2], _, _)) + raise SystemError + +except Exception as e: + print('ERROR' + str(e)) \ No newline at end of file -- 2.39.5 From f0dc6b508b759f025ee715e8259b96fe7a1b3bb9 Mon Sep 17 00:00:00 2001 From: lade043 <48773751+lade043@users.noreply.github.com> Date: Wed, 31 Jul 2019 19:46:17 +0200 Subject: [PATCH 6/8] Update issue templates --- .github/ISSUE_TEMPLATE/longterm-to-do.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/longterm-to-do.md diff --git a/.github/ISSUE_TEMPLATE/longterm-to-do.md b/.github/ISSUE_TEMPLATE/longterm-to-do.md new file mode 100644 index 0000000..1206841 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/longterm-to-do.md @@ -0,0 +1,11 @@ +--- +name: Longterm To-Do +about: If you have an idea to something that has to be implement but isn't a feature + and it isn't necessary to be done fast. You're right here +title: "[LONGTERM]" +labels: todo, longterm +assignees: '' + +--- + + -- 2.39.5 From 3f0b08710018c73429333cbda69909a83f75471e Mon Sep 17 00:00:00 2001 From: Lars Bogner Date: Wed, 31 Jul 2019 20:02:15 +0200 Subject: [PATCH 7/8] main --- main.py | 5 ++++- user_IO.py | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 209796f..8e36f6b 100644 --- a/main.py +++ b/main.py @@ -15,7 +15,10 @@ try: if subject_edit: subject_edit.add_grade_category(user_input[3], user_input[4]) elif user_input[1] == "subject": - subjects.append(subject.Subject(user_input[2], _, _)) + subjects.append(subject.Subject(user_input[2], user_input[3], user_input[4])) + elif user_input[0] == "output": + subject_get = subject.get_subject(subjects, user_input[1]) + user_IO.user_output(subject_get.) raise SystemError except Exception as e: diff --git a/user_IO.py b/user_IO.py index 3595133..91b6da5 100644 --- a/user_IO.py +++ b/user_IO.py @@ -10,7 +10,17 @@ def user_input(): user_add = input() if user_add == "subject": subject = input("Which subject do you want to add? \n") - return "input", "subject", subject + main_subject = input("Is this subject a main subject (Hauptfach)[y/n]? \n") + if main_subject == 'y': + main_subject = True + elif main_subject == 'n': + main_subject = False + oral_exam = input("Will there be an oral exam in this subject [y/n]? \n") + if oral_exam == 'y': + oral_exam = True + elif oral_exam == 'n': + oral_exam = False + return "input", "subject", subject, main_subject, oral_exam elif user_add == "category": subject = input("To which subject do you want to add the category? \n") category = input("Which category do you want to add? \n") @@ -22,3 +32,8 @@ def user_input(): grade = input("Grade? \n") grade_name = input("What's the name of the grade? \n") return "input", "grade", subject, category, grade, grade_name + + +def user_output(i): + # just filled with some standard output, has to be filled further + print(i) \ No newline at end of file -- 2.39.5 From e4d4acb345199d7cc9b0adf1d61ad6c64d59cdd9 Mon Sep 17 00:00:00 2001 From: Lars Bogner Date: Wed, 31 Jul 2019 20:03:22 +0200 Subject: [PATCH 8/8] main complete --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 8e36f6b..c238362 100644 --- a/main.py +++ b/main.py @@ -18,7 +18,7 @@ try: subjects.append(subject.Subject(user_input[2], user_input[3], user_input[4])) elif user_input[0] == "output": subject_get = subject.get_subject(subjects, user_input[1]) - user_IO.user_output(subject_get.) + user_IO.user_output(subject_get.return_average_subject) raise SystemError except Exception as e: -- 2.39.5