diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..f25ce26 Binary files /dev/null and b/.DS_Store differ diff --git a/DynamoDB.py b/DynamoDB.py deleted file mode 100644 index f3b00ff..0000000 --- a/DynamoDB.py +++ /dev/null @@ -1,60 +0,0 @@ -from boto3 import resource -from boto3.dynamodb.conditions import Attr, Key -import math - -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 courseInsert(courseId, courseSection, courseLevel, courseDepartment, courseProfessor, courseEnrolledStudents, courseMaxStudents, courseIsOpen, courseFormat, prerequisites, courseStartTime=0, courseEndTime=0, courseScheduledDays='None', courseLocation='None'): - courseInsertion = course_table.put_item( - Item = { - 'CourseId' : courseId, # partition key - 'Section' : courseSection, # sort key? - 'Level' : courseLevel, # useful attribute for searching - 'Department' : courseDepartment, # useful attribute for searching - 'Professor' : courseProfessor, # TODO: support multiple instructors - 'StudentsEnrolled' : courseEnrolledStudents, # useful attribute for professor - '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 - 'CourseFormat' : courseFormat, - 'CourseScheduledDays' : courseScheduledDays, # this will likely be a list, but im lazy so for now it's a string - 'PreRequisites' : prerequisites, # this will be a list of courses - 'CourseLocation' : courseLocation # could increase functionality by separating into building and room number, to allow searching by building - } - ) - - print(f"Insert response: {courseInsertion}") - -if __name__ == '__main__': - - # 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: ")) # 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 - elif len(courseSection) == 2: - courseSection = '0' + courseSection - courseType = input("\nSelect the type of course if needed: Laboratory, Discussion: ") - if courseType == "Laboratory": - courseSection += 'L' - elif courseType == "Discussion": - courseSection += 'D' - courseLevel = math.floor(courseNumber / 1000) * 1000 - courseId = courseDepartment + str(courseNumber) - courseProfessor = input("\nEnter professor: ") # TODO: support multiple instructors - courseMaxStudents = int(input("\nEnrollment slots: ")) - 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?: ") - - courseInsert(courseId, courseSection, courseLevel, courseDepartment, courseProfessor, courseEnrolledStudents, courseMaxStudents, courseStartTime, courseEndTime, courseIsOpen, courseFormat, courseScheduledDays, courseLocation) -