diff --git a/DynamoDB.py b/DynamoDB.py index 53ca2c0..1491369 100644 --- a/DynamoDB.py +++ b/DynamoDB.py @@ -5,7 +5,7 @@ course_table = resource('dynamodb').Table('Courses') # NOTE: another table for users and professors may be necessary. In order to do this we might need functionality to introduce salt and hashing for security -def insert(courseId, courseSection, courseLevel, courseDepartment, courseProfessor, courseEnrolledStudents, courseMaxStudents, courseStartTime, courseEndTime, courseIsOpen): +def insert(courseId, courseSection, courseLevel, courseDepartment, courseProfessor, courseEnrolledStudents, courseMaxStudents, courseStartTime, courseEndTime, courseIsOpen, courseFormat, courseScheduledDays, courseLocation): courseInsertion = course_table.put_item( Item = { 'CourseId' : courseId, # partition key @@ -17,7 +17,10 @@ def insert(courseId, courseSection, courseLevel, courseDepartment, courseProfess 'MaxStudents' : courseMaxStudents, # can calculate OpenStatus using some logic 'StartTime' : courseStartTime, # is storing times in the form of 24-hour time easier? it's simple to convert when necessary 'EndTime' : courseEndTime, - 'OpenStatus' : courseIsOpen # this attribute could be useful for hiding unavailable courses + 'OpenStatus' : courseIsOpen, # this attribute could be useful for hiding unavailable courses + 'CourseFormat' : courseFormat, + 'CourseScheduledDays' : courseScheduledDays, # this will likely be a list, but im lazy so for now it's a string + 'CourseLocation' : courseLocation # could increase functionality by separating into building and room number, to allow searching by building } ) @@ -27,7 +30,7 @@ def insert(courseId, courseSection, courseLevel, courseDepartment, courseProfess # NOTE: NONE OF THE INFO COLLECTING WILL LIKELY BE DONE IN PYTHON, THIS IS PROBABLY VUE STUFF. JUST FOR DEMO courseDepartment = input("Enter department: ").upper() - courseNumber = int(input("\nEnter course number: ")) # TODO: Error handling for invalid inputs + courseNumber = int(input("\nEnter course number: ")) # NOTE: In vue, make text box that only accepts integers to avoid errors courseSection = input("\nEnter course section: ") if len(courseSection) == 1: courseSection = '00' + courseSection @@ -42,10 +45,15 @@ def insert(courseId, courseSection, courseLevel, courseDepartment, courseProfess courseId = courseDepartment + str(courseNumber) courseProfessor = input("\nEnter professor: ") # TODO: support multiple instructors courseMaxStudents = int(input("\nEnrollment slots: ")) - courseStartTime = input("\nStart time: ") # TODO: Turn 12-hour time into 24-hour time integer - courseEndTime = input("\nEnd time: ") # TODO: Turn 12-hour time into 24-hour time integer + courseFormat = input("\nIs the course online asynchronous, online synchronous, or in-person?: ") # this will be easier to integrate with a few select vue options + if courseFormat == "In-person" or courseFormat == "Online synchronous": + courseScheduledDays = input("\nDays the course will meet: ") + courseStartTime = input("\nStart time: ") # TODO: Turn 12-hour time into 24-hour time integer. Will be easy with vue + courseEndTime = input("\nEnd time: ") # TODO: Turn 12-hour time into 24-hour time integer. Will be easy with vue courseEnrolledStudents = 0 courseIsOpen = bool(courseMaxStudents - courseEnrolledStudents) + if courseFormat == "In-person": + courseLocation = input("Where will the course be held?: ") - insert(courseId, courseSection, courseLevel, courseDepartment, courseProfessor, courseEnrolledStudents, courseMaxStudents, courseStartTime, courseEndTime, courseIsOpen) + insert(courseId, courseSection, courseLevel, courseDepartment, courseProfessor, courseEnrolledStudents, courseMaxStudents, courseStartTime, courseEndTime, courseIsOpen, courseFormat, courseScheduledDays, courseLocation)