From 7c81e13a97849d1bf27ccf4431b11945470fec97 Mon Sep 17 00:00:00 2001 From: Rebecca Hankey Date: Tue, 13 May 2025 18:00:06 -0400 Subject: [PATCH] I shifted the way that students can be added and also could be subtracted form the roster. I also did the first pass through of the view page. I have a list of things that I know should be included as part of the view, however I also am not sure how I want to go about showing this in the example app itself. I am a little stuck on this. I think that the mre effective way to do so would be to make a dummy-roster and add students manually in order to create the rest of the visual demonstration but to leave the roster function open to upload one's own roster. I am really enjoying the application of using the terminal to solve a problem that I choose. Even though it seems like a small one, there is a lot of investment (on my part) when I am solving my own problem. It also makes the wins in this project feel bigger somehow? I think that students would share that buy in! I have used the visual coding color coded error prompts (the red lettering) to help work through the visual side of things. The definitions for the app itself make sense and I feel confident writing those, however the visual side of things is tougher! As I work through what to print I tend to lose track of the () and {} and [] and ""... there are just so many! And they go in such particular places. So, that color coding has been great to identify problems before they become probleme burried away. --- project/app/models.py | 36 +++++++++++++++++++++++++++++++++--- project/app/views.py | 15 +++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/project/app/models.py b/project/app/models.py index a409203..e754f3c 100644 --- a/project/app/models.py +++ b/project/app/models.py @@ -8,12 +8,42 @@ class Roster: def __init__(self): self.students = [] + """List of student names""" + + def add_student(self, name): + self.students.append(name) + """Add students manually to the list. This may seem like a counter productive + way to add students, but this also adds the built in option to + omit students from the list if they have a prefered name that the school does + not recognize on a formal roster. You could manually enter them. This is + also good for stuednts with IEPs or 504s that dictate that a student should not be cold + called one. This would allow te teacher to still have the random reminder + to check in with them, but not just call them out. The name they add could come + with a note... + + For example it could say: + + -Elias "Check-In not Cold Call" + rather than just + -Elias""" - def load_from_list(self, names): - self.students = names + def load_from_list(self, names_list): + self.students = names_list + """Load full/fuller roster then use "Add Student" to further customize.""" - def get_random_student(self): + def pick_random_student(self): if not self.students: return None return random.choice(self.students) + """Choose a student""" + def count_students(self): + return len(self.students) + """Give teaceher the option to see how many students there are left to cold call.""" + + def remove_student(self, name): + if name in self.students: + self.students.remove(name) + return True + return False + """Remove student(s).""" diff --git a/project/app/views.py b/project/app/views.py index e69de29..d617783 100644 --- a/project/app/views.py +++ b/project/app/views.py @@ -0,0 +1,15 @@ +"""Need add, subtract, count, list, you were picked, and error +(meaning no student listed).""" + +from app.models import Roster + +print(f"{roster.count_students()} students remaining on Roster.") + +"""Count view.""" + +student = roster.pick_random_stuent() +if student: + print(f"[{student}, you were selected!!") +else: + print("Name not/no longer on current roster.") +