Skip to content

Commit

Permalink
added more attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Couillard authored and Nicholas Couillard committed Oct 5, 2023
1 parent e156c37 commit f8d2e39
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions DynamoDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
)

Expand All @@ -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
Expand All @@ -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)

0 comments on commit f8d2e39

Please sign in to comment.