Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Database/SQL code.sql
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done some modifications and merged this myself to the main.....you can check it and give me your thoughts...

Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ CREATE TABLE Enroll_in
(
Student_ID INT NOT NULL,
Course_Code VARCHAR(50) NOT NULL,
grade FLOAT ,
PRIMARY KEY (Student_ID, Course_Code),
FOREIGN KEY (Student_ID) REFERENCES Students(Student_ID),
FOREIGN KEY (Course_Code) REFERENCES Courses(Course_Code)
Expand Down
9 changes: 7 additions & 2 deletions GUI/sign-in/signin.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will test this file and come back to you...since github seems to reject this file

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is unneeded... since it is already implemented by kareem in app.py, and the sign-up and sign-in functions will be parts of users, teachers, and supervisors classes, not that it will have a file on its own

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask import Flask, render_template, request, redirect, url_for, flash

import datetime
app = Flask(__name__)
app.secret_key = 'super_secret_key'

Expand All @@ -19,13 +19,18 @@ def sign_in():

return redirect(url_for('index'))

# users must choose whether they are students or teachers
# it must be able to insert the data into the database
# it must be able to check if the data is valid (username must be unique, password must be strong using regex, email must be valid using regex)
# it must store the account creation date and time
@app.route('/signup', methods=['GET', 'POST'])
def sign_up():
if request.method == 'POST':
username = request.form['username']
email = request.form['email']
password = request.form['password']

flash(f'Username: {username}, Password: {password} created successfully!', 'success')
flash(f'Username: {username}, Email: {email},Password: {password} created successfully!', 'success')
return redirect(url_for('index'))

return render_template('signup.html')
Expand Down
40 changes: 40 additions & 0 deletions classes/courses.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

helpful stuff

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import databaseConnection
import students
import professors
query = connection.cursor()


class courses(students, professors):
def __init__(self, courseName, yearTeached, Semester, Course_Code, Capacity, Number_enrolled):
self.courseName = courseName
self.yearTeached = yearTeached
self.Semester = Semester
self.Course_Code = Course_Code
self.Capacity = Capacity
self.Number_enrolled = Number_enrolled

def createCourse(self, courseName, yearTeached, Semester, Course_Code, Capacity, Number_enrolled):
query.excute('''insert into Courses(courseName, yearTeached, Semester, Course_Code, Capacity, Number_enrolled)
values (?, ?, ?, ?, ?, ?)''', (courseName, yearTeached, Semester, Course_Code, Capacity, Number_enrolled))
query.commit()

def deleteCourse(self, courseName, yearTeached, Semester, Course_Code, Capacity, Number_enrolled):
query.excute('''delete from Courses where courseName = ? and yearTeached = ? and Semester = ? and Course_Code = ? and Capacity = ? and Number_enrolled = ?''', (courseName, yearTeached, Semester, Course_Code, Capacity, Number_enrolled))
query.commit()

def addStudentToCourse(self, student, Course_Code):
query.excute('''update Courses set Number_enrolled = ? where Course_Code = ?''', (Number_enrolled + 1 , Course_Code))
query.commit()
query.excute('''insert into Enroll_in set Student_ID = ?, Course_Code = ?, grade = ?''', (student.studentID, Course_Code, NULL))
query.commit()

def removeStudentFromCourse(self, student, Course_Code):
query.excute('''update Courses set Number_enrolled = ? where Course_Code = ?''', (Number_enrolled - 1 , Course_Code))
query.commit()
query.excute('''delete from Enroll_in where Student_ID = ? and Course_Code = ?''', (student.studentID, Course_Code))
query.commit()





44 changes: 44 additions & 0 deletions classes/submissions.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really promising work!! would make it alot easier for me to integrate

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from students import students
from databaseConnection import *
import random
import time

c = connection.cursor()
class submissions():
def submitWork(self, workLink, student):
submissionID = random.randint(1 , 10000)
if workLink.startswith("https://docs.google.com/") or workLink.startswith("https://drive.google.com/") and workLink.endswith("sharing"):
try:
# student id and upload id are hardcoded until edible population for the database
c.execute('''insert into Submissions(Submission_ID, Document_link, Student_ID, Upload_ID)
values (?, ?, ?, ?)''', (submissionID , workLink , 1, 1))
c.commit()
c.close()
print("Work submitted successfully")
except pyodbc.IntegrityError:
self.submitWork(workLink, student)
else:
print("Invalid link")
self.submitWork(input("Enter a valid link: "), student)

# when the student enter the link of the quiz, the setTimeForQuiz function will be called using get method linked by clicking on the link
def setTimeForQuiz(self, durationInMinutes):
# setting timer on
isStarted = True
isFinished = False
isEnded = False
# using google sheets api, when the student submit the quiz, the isFinished will be set to True
isFinished = True
if isFinished:
isStarted = False
print("Quiz has ended")
# when the durationInMinutes is over, the isEnded will be set to True
isEnded = True
if not isFinished and isEnded:
# close the forms using google forms API
print("Quiz has ended")
# add the grade to the database from the google sheets using google sheets API
c.execute('''insert into Enroll_in(Student_ID, Course_Code, grade)
values (?, ?, ?, ?)''', (random.randint(1,10000), EnrollIn.courseID,))
c.commit()
c.close()