mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-16 02:10:19 -04:00
Merge branch 'development' of github.com:Rushilwiz/SkoolOS into development
This commit is contained in:
commit
778446baa2
1
.profile
Normal file
1
.profile
Normal file
|
@ -0,0 +1 @@
|
|||
{'absences': 2, 'address': None, 'counselor': {'first_name': 'Sean', 'full_name': 'Sean Burke', 'id': 37, 'last_name': 'Burke', 'url': 'https://ion.tjhsst.edu/api/profile/37', 'user_type': 'counselor', 'username': 'SPBurke'}, 'display_name': 'Raffu Khondaker', 'emails': [], 'first_name': 'Raffu', 'full_name': 'Raffu Khondaker', 'grade': {'name': 'sophomore', 'number': 10}, 'graduation_year': 2022, 'id': 36508, 'ion_username': '2022rkhondak', 'is_announcements_admin': False, 'is_eighth_admin': False, 'is_student': True, 'is_teacher': False, 'last_name': 'Khondaker', 'middle_name': 'Al', 'nickname': '', 'phones': [], 'picture': 'https://ion.tjhsst.edu/api/profile/36508/picture', 'sex': 'Male', 'short_name': 'Raffu', 'title': None, 'tj_email': '2022rkhondak@tjhsst.edu', 'user_type': 'student', 'websites': []}
|
|
@ -1,2 +0,0 @@
|
|||
import os
|
||||
os.spawnl(os.P_DETACH, 'some_long_running_command')
|
|
@ -14,7 +14,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div class="d-flex align-items-center justify-content-center" style="height: 100vh">
|
||||
<a href="https://ion.tjhsst.edu/oauth/authorize/?response_type=code&client_id=QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2F&scope=read&state=bVchSMe63qFXMYxOYthCfuqEr9FAdI" title="Ion" class="border border-dark p-3 btn btn-lg mx-auto" style="box-shadow: 5px 10px;">
|
||||
<a href="https://ion.tjhsst.edu/oauth/authorize/?response_type=code&client_id=QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2F&scope=read&state=81xYFv6S9CLi7laXQ64gJWskDJUMMb" title="Ion" class="border border-dark p-3 btn btn-lg mx-auto" style="box-shadow: 5px 10px;">
|
||||
<img src="https://ion.tjhsst.edu/static/img/favicon.png">
|
||||
Sign in with Ion
|
||||
</a>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
asgiref==3.2.7
|
||||
certifi==2020.4.5.1
|
||||
chardet==3.0.4
|
||||
click==7.1.2
|
||||
Django==3.0.7
|
||||
django-cors-middleware==1.5.0
|
||||
django-oauth-toolkit==1.3.2
|
||||
djangorestframework==3.11.0
|
||||
idna==2.9
|
||||
oauthlib==3.1.0
|
||||
prompt-toolkit==1.0.14
|
||||
Pygments==2.6.1
|
||||
PyInquirer==1.0.3
|
||||
pytz==2020.1
|
||||
regex==2020.5.14
|
||||
requests==2.23.0
|
||||
selenium==3.141.0
|
||||
six==1.15.0
|
||||
sqlparse==0.3.1
|
||||
urllib3==1.25.9
|
||||
wcwidth==0.2.3
|
46
CLI/s-git.py
46
CLI/s-git.py
|
@ -7,6 +7,7 @@ import json
|
|||
import shutil
|
||||
import time
|
||||
import pyperclip
|
||||
import datetime
|
||||
|
||||
#git clone student directory ==> <student-id>/classes/assignments
|
||||
|
||||
|
@ -147,11 +148,38 @@ class Student:
|
|||
print(putDB(data, self.url))
|
||||
print("Synced to " + self.username)
|
||||
|
||||
def getClasses(self):
|
||||
classes = self.classes
|
||||
for c in classes:
|
||||
print(c['name'])
|
||||
|
||||
def getAssignments(self, course, span):
|
||||
span = datetime.timedelta(span, 0)
|
||||
classes = self.classes
|
||||
for c in classes:
|
||||
print(c['name'])
|
||||
alist = c['assignments'].split(",")
|
||||
for a in alist:
|
||||
ass = getDB("http://127.0.0.1:8000/api/assignments/" + a)
|
||||
now = datetime.datetime.now()
|
||||
try:
|
||||
due = ass['due_date'].replace("T", " ").replace("Z", "")
|
||||
due = datetime.datetime.strptime(due, '%Y-%m-%d %H:%M:%S.%f')
|
||||
diff = now - due
|
||||
zero = datetime.timedelta(0,0)
|
||||
#check due ddate is in span range is now past date (- timdelta)
|
||||
if(diff < span and diff > zero):
|
||||
print((now-due))
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
pass
|
||||
|
||||
#update API and Github, all assignments / classes
|
||||
def update(self):
|
||||
cdir = os.getcwd()
|
||||
os.chdir(self.username)
|
||||
command("git checkout master")
|
||||
for c in self.classes:
|
||||
print("UPDATING CLASS: " + str(c['name']))
|
||||
data = getDB("http://127.0.0.1:8000/api/classes/" + str(c['name']))
|
||||
|
@ -167,6 +195,19 @@ class Student:
|
|||
print("ADDING CLASS: " + str(c['name']))
|
||||
self.addClass(str(c['name']))
|
||||
command("git checkout master")
|
||||
|
||||
#updates 1 class, does not switch to master
|
||||
def updateClass(self, course):
|
||||
if((course in self.sclass) == False):
|
||||
print("Class not found")
|
||||
return
|
||||
cdir = os.getcwd()
|
||||
os.chdir(self.username)
|
||||
command("git checkout " + course)
|
||||
command("git add .")
|
||||
command("git commit -m " + course)
|
||||
command("git pull origin " + course)
|
||||
command("git push -u origin " + course)
|
||||
|
||||
#class name format: <course-name>_<ion_user>
|
||||
|
||||
|
@ -347,5 +388,8 @@ class Student:
|
|||
|
||||
data = getStudent("2022rkhondak")
|
||||
s = Student(data)
|
||||
# s.viewClass("English11_eharris1")
|
||||
#s.viewClass("APLit_eharris1")
|
||||
#s.updateClass("APLit_eharris1")
|
||||
#s.update()
|
||||
s.exitCLI()
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
from socket import *
|
||||
from selenium import webdriver
|
||||
import http.server
|
||||
import socketserver
|
||||
import threading
|
||||
from http.server import HTTPServer
|
||||
|
||||
class HTTPServer(BaseHTTPServer.HTTPServer):
|
||||
|
||||
def create_server():
|
||||
port = 8000
|
||||
handler = http.server.SimpleHTTPRequestHandler
|
||||
httpd = socketserver.TCPServer(("", port), handler)
|
||||
print("serving at port:" + str(port))
|
||||
httpd.serve_forever()
|
||||
_continue = True
|
||||
|
||||
def serve_until_shutdown(self):
|
||||
while self._continue:
|
||||
self.handle_request()
|
||||
|
||||
threading.Thread(target=create_server).start()
|
||||
def shutdown(self):
|
||||
self._continue = False
|
||||
# We fire a last request at the server in order to take it out of the
|
||||
# while loop in `self.serve_until_shutdown`.
|
||||
try:
|
||||
urllib2.urlopen(
|
||||
'http://%s:%s/' % (self.server_name, self.server_port))
|
||||
except urllib2.URLError:
|
||||
# If the server is already shut down, we receive a socket error,
|
||||
# which we ignore.
|
||||
pass
|
||||
self.server_close()
|
||||
|
||||
print("Server has started. Continuing..")
|
||||
|
||||
browser = webdriver.Chrome()
|
||||
browser.get("http://localhost:8000")
|
||||
|
||||
assert "<title>" in browser.page_source
|
||||
|
|
|
@ -10,6 +10,7 @@ import http.server
|
|||
import socketserver
|
||||
from threading import Thread
|
||||
from werkzeug.urls import url_decode
|
||||
import pprint
|
||||
|
||||
client_id = r'QeZPBSKqdvWFfBv1VYTSv9iFGz5T9pVJtNUjbEr6'
|
||||
client_secret = r'0Wl3hAIGY9SvYOqTOLUiLNYa4OlCgZYdno9ZbcgCT7RGQ8x2f1l2HzZHsQ7ijC74A0mrOhhCVeZugqAmOADHIv5fHxaa7GqFNtQr11HX9ySTw3DscKsphCVi5P71mlGY'
|
||||
|
@ -20,27 +21,38 @@ scope = ["read"]
|
|||
|
||||
def main():
|
||||
print("")
|
||||
print(" SSSSS CCCCC HH HH OOOOO OOOOO LL OOOOO SSSSS ")
|
||||
print("SS CC C HH HH OO OO OO OO LL OO OO SS ")
|
||||
print(" SSSSS CC HHHHHHH OO OO OO OO LL OO OO SSSSS ")
|
||||
print(" SS CC C HH HH OO OO OO OO LL OO OO SS")
|
||||
print(" SSSSS CCCCC HH HH OOOO0 OOOO0 LLLLLLL OOOO0 SSSSS ")
|
||||
print("░██████╗██╗░░██╗░█████╗░░█████╗░██╗░░░░░ ░█████╗░░██████╗")
|
||||
print("██╔════╝██║░██╔╝██╔══██╗██╔══██╗██║░░░░░ ██╔══██╗██╔════╝")
|
||||
print("╚█████╗░█████═╝░██║░░██║██║░░██║██║░░░░░ ██║░░██║╚█████╗░")
|
||||
print("░╚═══██╗██╔═██╗░██║░░██║██║░░██║██║░░░░░ ██║░░██║░╚═══██╗")
|
||||
print("██████╔╝██║░╚██╗╚█████╔╝╚█████╔╝███████╗ ╚█████╔╝██████╔╝")
|
||||
print("╚═════╝░╚═╝░░╚═╝░╚════╝░░╚════╝░╚══════╝ ░╚════╝░╚═════╝░")
|
||||
print("")
|
||||
|
||||
if not os.path.exists(".profile"):
|
||||
print(76546789876545678765)
|
||||
authenticate()
|
||||
print(open(".profile", "r").read())
|
||||
else:
|
||||
print(open(".profile", "r").read())
|
||||
|
||||
while True:
|
||||
pass
|
||||
# while True:
|
||||
# pass
|
||||
|
||||
|
||||
def authenticate():
|
||||
oauth = OAuth2Session(client_id=client_id, redirect_uri=redirect_uri, scope=scope)
|
||||
authorization_url, state = oauth.authorization_url("https://ion.tjhsst.edu/oauth/authorize/")
|
||||
|
||||
cdir = os.getcwd()
|
||||
#Linux: chromdriver-linux
|
||||
#Macos: chromdriver-mac
|
||||
#Windows: chromdriver.exe
|
||||
path = os.path.join(cdir, "chromedriver-mac")
|
||||
print(path)
|
||||
browser = webdriver.Chrome(path)
|
||||
browser = webdriver.Safari()
|
||||
|
||||
web_dir = os.path.join(os.path.dirname(__file__), 'oauth')
|
||||
os.chdir(web_dir)
|
||||
if os.path.exists("index.html"):
|
||||
|
@ -53,15 +65,13 @@ def authenticate():
|
|||
template.close()
|
||||
index.close()
|
||||
|
||||
# server = Thread(target=create_server)
|
||||
# server.daemon = True
|
||||
# server.start()
|
||||
server = Thread(target=create_server)
|
||||
server.daemon = True
|
||||
server.start()
|
||||
|
||||
browser = webdriver.Chrome()
|
||||
browser.get("localhost:8000/")
|
||||
|
||||
while "http://localhost:8000/?code" not in browser.current_url:
|
||||
http.server.
|
||||
time.sleep(0.25)
|
||||
|
||||
url = browser.current_url
|
||||
|
@ -83,17 +93,20 @@ def authenticate():
|
|||
|
||||
# And finally get the user's profile!
|
||||
profile = requests.get("https://ion.tjhsst.edu/api/profile", headers=headers).json()
|
||||
print(profile)
|
||||
|
||||
pprint.pprint(profile)
|
||||
username = profile['ion_username']
|
||||
email = profile['tj_email']
|
||||
first_name = profile['first_name']
|
||||
last_name = profile['last_name']
|
||||
|
||||
os.chdir(cdir)
|
||||
profileFile = open(".profile", "w")
|
||||
profileFile.write(profile)
|
||||
#profileFile.write(profile.text())
|
||||
profileFile.write(str(profile))
|
||||
profileFile.close()
|
||||
|
||||
# server.stop
|
||||
sys.exit
|
||||
|
||||
|
||||
def create_server():
|
||||
|
|
203
CLI/t-git.py
203
CLI/t-git.py
|
@ -154,7 +154,7 @@ class Teacher:
|
|||
if (self.checkClass(path)):
|
||||
cname = path.split("/")
|
||||
cname = cname[len(cname)-1]
|
||||
cpath = self.username + "/" + cname[len(cname)-1]
|
||||
cpath = self.username + "/" + cname
|
||||
data = {
|
||||
"name": cname,
|
||||
"repo": "",
|
||||
|
@ -193,7 +193,7 @@ class Teacher:
|
|||
#make a new class from scratch
|
||||
#subject: string, assignments: list
|
||||
#class name must be: <subject>_<ion_user>
|
||||
def makeClass(self, cname, assignments):
|
||||
def makeClass(self, cname):
|
||||
#check if class exists
|
||||
path = self.username + "/" + cname
|
||||
isclass = False
|
||||
|
@ -216,7 +216,7 @@ class Teacher:
|
|||
f=open(path + "/README.md", "w")
|
||||
f.close()
|
||||
#push to remote repo
|
||||
os.chdir(path)
|
||||
# os.chdir(path)
|
||||
# for a in assignments:
|
||||
|
||||
# os.mkdir(a)
|
||||
|
@ -280,14 +280,14 @@ class Teacher:
|
|||
def reqStudent(self, sname, cname):
|
||||
if(self.isStudent(sname) == False):
|
||||
print(sname + " does not exist.")
|
||||
return
|
||||
return False
|
||||
course = getDB("http://127.0.0.1:8000/api/classes/" + cname)
|
||||
if(sname in course['unconfirmed']):
|
||||
print (sname + " already requested.")
|
||||
return
|
||||
return True
|
||||
if(sname in course['confirmed']):
|
||||
print (sname + " alredy enrolled.")
|
||||
return
|
||||
return False
|
||||
|
||||
student = getDB("http://127.0.0.1:8000/api/students/" + sname)
|
||||
try:
|
||||
|
@ -297,7 +297,7 @@ class Teacher:
|
|||
student['added_to']=student['added_to']+ "," + course['name']
|
||||
except:
|
||||
print(sname + " does not exist.")
|
||||
return
|
||||
return False
|
||||
print(student['added_to'])
|
||||
s={
|
||||
'first_name':student["first_name"],
|
||||
|
@ -323,31 +323,34 @@ class Teacher:
|
|||
"repo": "",
|
||||
"path": self.username + "/" + course['name'],
|
||||
"teacher": self.username,
|
||||
"assignments": "",
|
||||
"assignments": course['assignments'],
|
||||
"default_file": "",
|
||||
"confirmed": course["confirmed"],
|
||||
"unconfirmed": course['unconfirmed']
|
||||
}
|
||||
print(putDB(cinfo, course['url']))
|
||||
|
||||
return True
|
||||
|
||||
#Student should have confirmed on their endd, but class had not been updated yet
|
||||
#git clone confirmed student repo, copy files into repo and push branch
|
||||
def addStudent(self, sname, cname):
|
||||
if(self.isStudent(sname) == False):
|
||||
print(sname + " does not exist.")
|
||||
return
|
||||
return False
|
||||
|
||||
student = getDB("http://127.0.0.1:8000/api/students/" + sname)
|
||||
course = getDB("http://127.0.0.1:8000/api/classes/" + cname)
|
||||
|
||||
if((student['ion_user'] in course['unconfirmed']) == False):
|
||||
print("Student has not been requested to join yet.")
|
||||
return
|
||||
if((cname in student['added_to']) == True or (cname in student['classes']) == False):
|
||||
print("Student has not confirmed class yet")
|
||||
return
|
||||
if(os.path.exists(self.username + "/Students/" + cname + "/" + student['ion_user']) or (student['ion_user'] in course['confirmed']) == True):
|
||||
print("Student already added to class")
|
||||
print(student['ion_user'] + " already added to class")
|
||||
return True
|
||||
if((cname in student['added_to']) == True or (cname in student['classes']) == False):
|
||||
print(student['ion_user']+ " has not confirmed class yet")
|
||||
return False
|
||||
if((student['ion_user'] in course['unconfirmed']) == False):
|
||||
print(course['unconfirmed'])
|
||||
print(student['ion_user']+" has not been requested to join yet.")
|
||||
return False
|
||||
|
||||
#git clone and make student/class directories
|
||||
cdir = os.getcwd()
|
||||
|
@ -362,67 +365,97 @@ class Teacher:
|
|||
os.chdir(cdir)
|
||||
|
||||
#push to git
|
||||
copy_tree(cpath, path + "/" + student['ion_user'])
|
||||
os.chdir(spath)
|
||||
command('git checkout ' + cname)
|
||||
command('git pull origin ' + cname)
|
||||
os.chdir(cdir)
|
||||
copy_tree(cpath, path + "/" + student['ion_user'])
|
||||
os.chdir(spath)
|
||||
command('git add .')
|
||||
command('git commit -m Hello')
|
||||
command('git push -u origin ' + cname)
|
||||
command('git checkout master')
|
||||
os.chdir(cdir)
|
||||
|
||||
if(course['confirmed']==""):
|
||||
course['confirmed']=student['ion_user']
|
||||
else:
|
||||
course['confirmed']=course['confirmed']+ "," + student['ion_user']
|
||||
|
||||
#only 1 pereson on confirmeed
|
||||
if(("," in course['unconfirmed']) == False):
|
||||
course['unconfirmed']=""
|
||||
#mutiple
|
||||
else:
|
||||
course['unconfirmed']= course['unconfirmed'].replace("," + student['ion_user'], "")
|
||||
course['unconfirmed']= course['unconfirmed'].replace(student['ion_user']+",", "")
|
||||
|
||||
cinfo = {
|
||||
"name": course['name'],
|
||||
"repo": "",
|
||||
"path": course['path'],
|
||||
"teacher": course['name'],
|
||||
"assignments": "",
|
||||
"teacher": self.username,
|
||||
"assignments": course['assignments'],
|
||||
"default_file": "",
|
||||
"confirmed": course["confirmed"],
|
||||
"unconfirmed": course['unconfirmed']
|
||||
}
|
||||
print(putDB(cinfo, course['url']))
|
||||
return True
|
||||
|
||||
#goes through list of studennts, tries to add, then request, return unconfirmed students
|
||||
def reqAddStudentList(self, array, cname):
|
||||
unconf = []
|
||||
for i in range(len(array)):
|
||||
a = array[i]
|
||||
if(self.addStudent(a, cname) == False):
|
||||
self.reqStudent(a, cname)
|
||||
unconf.append(a)
|
||||
return unconf
|
||||
|
||||
#add local path to student directory, make new instance in api
|
||||
def addAssignment(self, path, course, due):
|
||||
parts = path.split("/")
|
||||
aname = parts[len(parts)-1]
|
||||
|
||||
if(os.path.isdir(path) == 0 or len(parts) < 3) or aname in self.sclass:
|
||||
print("Not valid path.")
|
||||
return
|
||||
return False
|
||||
if((parts[1] in self.sclass) == False):
|
||||
print("Not in valid class directory")
|
||||
return
|
||||
return False
|
||||
#parts of assignment name (Essay1, APLit)
|
||||
if((course in aname) == False):
|
||||
print("Assignment named incorrectly; could be "+ aname + "_" + course)
|
||||
return False
|
||||
|
||||
ar = [x[2] for x in os.walk(path)]
|
||||
print(ar)
|
||||
for folder in ar:
|
||||
if len(folder) == 0:
|
||||
print("Assignment is completely empty, need a file.")
|
||||
return
|
||||
aname = parts[len(parts)-1]
|
||||
print("Assignment is completely empty, needs a file.")
|
||||
return False
|
||||
p1 = course.split("_")[0]
|
||||
if(p1 in aname == False):
|
||||
print(aname + "incorrectly formated: must be " + aname + "_" + p1 + ".")
|
||||
return
|
||||
return False
|
||||
try:
|
||||
datetime.strptime(due, '%Y-%m-%d %H:%M:%S.%f')
|
||||
except:
|
||||
print("Due-date format is incorrect")
|
||||
return
|
||||
return False
|
||||
|
||||
ass = {
|
||||
'name': aname,
|
||||
'path':path,
|
||||
'classes':course,
|
||||
'teacher':self.username,
|
||||
'due_date':due
|
||||
}
|
||||
postDB(ass, 'http://127.0.0.1:8000/api/assignments/' + aname + "/")
|
||||
course = getDB("http://127.0.0.1:8000/api/classes/" + course)
|
||||
if(aname in course['assignments']):
|
||||
print("Assignment name already taken.")
|
||||
return False
|
||||
|
||||
print(course['assignments'])
|
||||
input()
|
||||
#################### FINISH VERIFYING
|
||||
|
||||
if(os.path.exists(os.getcwd() + "/" + self.username + "/Students/" + course['name']) == False):
|
||||
print("No students in this class yet")
|
||||
return True
|
||||
slist = os.listdir(os.getcwd() + "/" + self.username + "/Students/" + course['name'])
|
||||
cdir = os.getcwd()
|
||||
for st in slist:
|
||||
|
@ -441,6 +474,38 @@ class Teacher:
|
|||
os.chdir(cdir)
|
||||
else:
|
||||
print(st + " already has assignment")
|
||||
|
||||
#check if assignment already exists
|
||||
r = requests.get(url = 'http://127.0.0.1:8000/api/assignments/' + aname, auth=('raffukhondaker','hackgroup1'))
|
||||
if(r.status_code != 200):
|
||||
ass = {
|
||||
'name': aname,
|
||||
'path':path,
|
||||
'classes':course['name'],
|
||||
'teacher':self.username,
|
||||
'due_date':due
|
||||
}
|
||||
postDB(ass, 'http://127.0.0.1:8000/api/assignments/')
|
||||
if(course['assignments'] == ""):
|
||||
course['assignments'] = aname
|
||||
else:
|
||||
course['assignments'] = course['assignments'] + "," + aname
|
||||
|
||||
cinfo = {
|
||||
"name": course['name'],
|
||||
"repo": "",
|
||||
"path": course['path'],
|
||||
"teacher": "eharris1",
|
||||
"assignments": course['assignments'],
|
||||
"default_file": "",
|
||||
"confirmed": course["confirmed"],
|
||||
"unconfirmed": course['unconfirmed']
|
||||
}
|
||||
putDB(cinfo, "http://127.0.0.1:8000/api/classes/" + course['name'] + "/")
|
||||
return True
|
||||
else:
|
||||
print("Assignment already addedd")
|
||||
return True
|
||||
|
||||
#try to avoid
|
||||
#copy modified assignments to student directories
|
||||
|
@ -491,7 +556,7 @@ class Teacher:
|
|||
command('git pull origin ' + course)
|
||||
os.chdir(cdir)
|
||||
|
||||
def getHistory(self, student, course):
|
||||
def getCommits(self, student, course, commits):
|
||||
course = getDB("http://127.0.0.1:8000/api/classes/" + course)
|
||||
try:
|
||||
if((student in course['confirmed']) == False):
|
||||
|
@ -503,10 +568,11 @@ class Teacher:
|
|||
|
||||
cdir = os.getcwd()
|
||||
os.chdir(self.username + "/Students/" + course['name'] + "/" + student)
|
||||
process = subprocess.Popen(['git', 'log', '-30', course['name']], stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
process = subprocess.Popen(['git', 'log', '-' + str(commits), course['name']], stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
p=process.poll()
|
||||
output = process.communicate()[0].decode('utf-8').split('\n\n')
|
||||
months = ['Jan', 'Feb', 'Mar', "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"]
|
||||
fout = []
|
||||
for i in range(len(output)):
|
||||
if("Date" in output[i]):
|
||||
c = output[i].split("\n")
|
||||
|
@ -524,9 +590,27 @@ class Teacher:
|
|||
mon = m
|
||||
d1 = datetime(int(date[4]), mon, int(date[2]), int(times[0]), int(times[1]))
|
||||
#datetime1 = datetime.strptime('07/11/2019 02:45PM', '%m/%d/%Y %I:%M%p')
|
||||
output[i] = [c[0], d1]
|
||||
fout.append([c[0],d1])
|
||||
#output[i] = [c[0], d1]
|
||||
#print(output[i])
|
||||
print(fout)
|
||||
os.chdir(cdir)
|
||||
return fout
|
||||
|
||||
def getChanges(self, student, course, commits):
|
||||
course = getDB("http://127.0.0.1:8000/api/classes/" + course + "/")
|
||||
ar = self.getCommits(student, course['name'], commits)
|
||||
commit = ar[len(ar)-1][0]
|
||||
start = ""
|
||||
print("END:" + commit)
|
||||
print("START: " + start)
|
||||
cdir = os.getcwd()
|
||||
os.chdir(self.username + "/Students/" + course['name'] + "/" + student)
|
||||
process = subprocess.Popen(['git', 'diff', commit, '--name-status'], stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
||||
p=process.poll()
|
||||
output = process.communicate()[0].decode('utf-8')
|
||||
print(output)
|
||||
os.chdir(cdir)
|
||||
return output
|
||||
|
||||
'''
|
||||
assignment = {
|
||||
|
@ -536,15 +620,14 @@ class Teacher:
|
|||
'''
|
||||
#check if assignment changed after due date
|
||||
def afterSubmit(self, course, assignment, student):
|
||||
'''
|
||||
assignment = getDB()
|
||||
'''
|
||||
assignment = {
|
||||
'name': assignment,
|
||||
'due_date': "2020-04-11 16:58:33.383124",
|
||||
'classes':course
|
||||
}
|
||||
log = self.getHistory(student, course)
|
||||
|
||||
assignment = getDB("http://127.0.0.1:8000/api/assignments/" + assignment)
|
||||
# assignment = {
|
||||
# 'name': assignment,
|
||||
# 'due_date': "2020-04-11 16:58:33.383124",
|
||||
# 'classes':course
|
||||
# }
|
||||
log = self.getCommits(student, course, 30)
|
||||
assignment['due_date'] = datetime.strptime(assignment['due_date'], '%Y-%m-%d %H:%M:%S.%f')
|
||||
late = False
|
||||
cdir = os.getcwd()
|
||||
|
@ -571,4 +654,24 @@ class Teacher:
|
|||
|
||||
data = getTeacher("eharris1")
|
||||
t = Teacher(data)
|
||||
t.getStudents("English11_eharris1")
|
||||
# t.makeClass("APLit_eharris1")
|
||||
#t.addAssignment("eharris1/APLit_eharris1/Lab3_APLit_eharris1", "APLit_eharris1", '2020-08-11 16:58:33.383124')
|
||||
#ar = ['2022rkhondak','2022inafi','2023rumareti']
|
||||
#extra = t.reqAddStudentList(ar, "APLit_eharris1")
|
||||
#print(extra)
|
||||
t.getStudents('2022rkhondak')
|
||||
t.getChanges('2022rkhondak','APLit_eharris1', 10)
|
||||
|
||||
'''
|
||||
TO-DO
|
||||
- More checks
|
||||
- add students to APLit_eharris1
|
||||
- make new class, make newe assignment, add/req students, make assignment
|
||||
- Add assignment to class after being made
|
||||
- Check if assignment name is taken
|
||||
- getUsage on student
|
||||
- comit history
|
||||
- check differences between commits
|
||||
- check if student changes file after submissionn deadline
|
||||
'''
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
import textract
|
||||
text = textract.process('test.py')
|
28
Website/api/migrations/0004_auto_20200612_0813.py
Normal file
28
Website/api/migrations/0004_auto_20200612_0813.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Generated by Django 3.0.7 on 2020-06-12 08:13
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0003_auto_20200612_0135'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='classes',
|
||||
name='assignments',
|
||||
field=models.TextField(blank=True, default=''),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='classes',
|
||||
name='default_file',
|
||||
field=models.CharField(blank=True, default='', max_length=100),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='classes',
|
||||
name='repo',
|
||||
field=models.URLField(blank=True, default=''),
|
||||
),
|
||||
]
|
|
@ -20,11 +20,11 @@ class Assignment(models.Model):
|
|||
|
||||
class Classes(models.Model):
|
||||
name = models.CharField(primary_key=True, max_length=100)
|
||||
repo=models.URLField(default="")
|
||||
repo=models.URLField(default="", blank=True)
|
||||
path=models.CharField(max_length=100, default="")
|
||||
teacher=models.CharField(max_length=100, default="")
|
||||
assignments=models.CharField(max_length=100, default="")
|
||||
default_file=models.CharField(max_length=100, default="")
|
||||
assignments=models.TextField(default="", blank=True)
|
||||
default_file=models.CharField(max_length=100, default="", blank=True)
|
||||
confirmed=models.TextField(default="", blank=True)
|
||||
unconfirmed=models.TextField(default="", blank=True)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import sys
|
|||
|
||||
|
||||
def main():
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'skoolsite.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'skoolos.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
|
|
0
Website/skoolos/__init__.py
Normal file
0
Website/skoolos/__init__.py
Normal file
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
ASGI config for skoolsite project.
|
||||
ASGI config for skoolos project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
|
@ -11,6 +11,6 @@ import os
|
|||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'skoolsite.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'skoolos.settings')
|
||||
|
||||
application = get_asgi_application()
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Django settings for skoolsite project.
|
||||
Django settings for skoolos project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 3.0.7.
|
||||
|
||||
|
@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
|
|||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'users.apps.UsersConfig',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
|
@ -39,6 +40,8 @@ INSTALLED_APPS = [
|
|||
'django.contrib.staticfiles',
|
||||
'rest_framework',
|
||||
'api',
|
||||
'crispy_forms',
|
||||
|
||||
|
||||
]
|
||||
|
||||
|
@ -60,7 +63,7 @@ MIDDLEWARE = [
|
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'skoolsite.urls'
|
||||
ROOT_URLCONF = 'skoolos.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
|
@ -78,7 +81,7 @@ TEMPLATES = [
|
|||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'skoolsite.wsgi.application'
|
||||
WSGI_APPLICATION = 'skoolos.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
|
@ -129,3 +132,7 @@ USE_TZ = True
|
|||
# https://docs.djangoproject.com/en/3.0/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
||||
|
||||
LOGIN_REDIRECT_URL = '/'
|
23
Website/skoolos/urls.py
Normal file
23
Website/skoolos/urls.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from django.urls import path
|
||||
from rest_framework import routers
|
||||
from api import views as api_views
|
||||
from django.contrib import admin
|
||||
from django.conf.urls import include
|
||||
from django.contrib.auth import views as auth_views
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'students', api_views.StudentViewSet)
|
||||
router.register(r'teachers', api_views.TeacherViewSet)
|
||||
router.register(r'assignments', api_views.AssignmentViewSet)
|
||||
router.register(r'classes', api_views.ClassesViewSet)
|
||||
router.register(r'files', api_views.DefFilesViewSet)
|
||||
|
||||
|
||||
# Wire up our API using automatic URL routing.
|
||||
# Additionally, we include login URLs for the browsable API.
|
||||
urlpatterns = [
|
||||
path('api/', include(router.urls)),
|
||||
path('api-auth/', include('rest_framework.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
path('login/', auth_views.LoginView.as_view(template_name="users/login.html"), name='login')
|
||||
]
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
WSGI config for skoolsite project.
|
||||
WSGI config for skoolos project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
|
@ -11,6 +11,6 @@ import os
|
|||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'skoolsite.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'skoolos.settings')
|
||||
|
||||
application = get_wsgi_application()
|
|
@ -1,31 +0,0 @@
|
|||
from django.urls import path
|
||||
from rest_framework import routers
|
||||
from api import views
|
||||
from django.contrib import admin
|
||||
from django.conf.urls import include
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'students', views.StudentViewSet)
|
||||
router.register(r'teachers', views.TeacherViewSet)
|
||||
router.register(r'assignments', views.AssignmentViewSet)
|
||||
router.register(r'classes', views.ClassesViewSet)
|
||||
router.register(r'files', views.DefFilesViewSet)
|
||||
|
||||
|
||||
# Wire up our API using automatic URL routing.
|
||||
# Additionally, we include login URLs for the browsable API.
|
||||
urlpatterns = [
|
||||
path('api/', include(router.urls)),
|
||||
path('api-auth/', include('rest_framework.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
|
||||
]
|
||||
'''
|
||||
{
|
||||
"name": "Entry1",
|
||||
"due_date": "2020-05-11 12:25:00",
|
||||
"path": "",
|
||||
"classes": "",
|
||||
"teacher": ""
|
||||
}
|
||||
'''
|
0
Website/users/__init__.py
Normal file
0
Website/users/__init__.py
Normal file
3
Website/users/admin.py
Normal file
3
Website/users/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
5
Website/users/apps.py
Normal file
5
Website/users/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class UsersConfig(AppConfig):
|
||||
name = 'users'
|
0
Website/users/migrations/__init__.py
Normal file
0
Website/users/migrations/__init__.py
Normal file
3
Website/users/models.py
Normal file
3
Website/users/models.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
BIN
Website/users/static/users/black_on_white.png
Normal file
BIN
Website/users/static/users/black_on_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
BIN
Website/users/static/users/mosaic.png
Normal file
BIN
Website/users/static/users/mosaic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 205 KiB |
104
Website/users/static/users/styles.css
Normal file
104
Website/users/static/users/styles.css
Normal file
|
@ -0,0 +1,104 @@
|
|||
@import url(https://fonts.googleapis.com/css?family=Roboto:300);
|
||||
|
||||
|
||||
|
||||
.login-page {
|
||||
width: 360px;
|
||||
padding: 8% 0 0;
|
||||
margin: auto;
|
||||
}
|
||||
.form {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background: #FFFFFF;
|
||||
max-width: 360px;
|
||||
height; 100vh;
|
||||
margin: 0 auto 100px;
|
||||
padding: 45px;
|
||||
text-align: center;
|
||||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
|
||||
}
|
||||
.form input {
|
||||
font-family: "Roboto", sans-serif;
|
||||
outline: 0;
|
||||
background: #f2f2f2;
|
||||
width: 100%;
|
||||
border: 0;
|
||||
margin: 0 0 15px;
|
||||
padding: 15px;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
}
|
||||
.form button {
|
||||
font-family: "Roboto", sans-serif;
|
||||
text-transform: uppercase;
|
||||
outline: 0;
|
||||
background: #4CAF50;
|
||||
width: 100%;
|
||||
border: 0;
|
||||
padding: 15px;
|
||||
color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
-webkit-transition: all 0.3 ease;
|
||||
transition: all 0.3 ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
.form button:hover,.form button:active,.form button:focus {
|
||||
background: #43A047;
|
||||
}
|
||||
.form .message {
|
||||
margin: 15px 0 0;
|
||||
color: #b3b3b3;
|
||||
font-size: 12px;
|
||||
}
|
||||
.form .message a {
|
||||
color: #4CAF50;
|
||||
text-decoration: none;
|
||||
}
|
||||
.form .register-form {
|
||||
display: none;
|
||||
}
|
||||
.container {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
max-width: 300px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.container:before, .container:after {
|
||||
content: "";
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
.container .info {
|
||||
margin: 50px auto;
|
||||
text-align: center;
|
||||
}
|
||||
.container .info h1 {
|
||||
margin: 0 0 15px;
|
||||
padding: 0;
|
||||
font-size: 36px;
|
||||
font-weight: 300;
|
||||
color: #1a1a1a;
|
||||
}
|
||||
.container .info span {
|
||||
color: #4d4d4d;
|
||||
font-size: 12px;
|
||||
}
|
||||
.container .info span a {
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
.container .info span .fa {
|
||||
color: #EF3B3A;
|
||||
}
|
||||
body {
|
||||
background: #fff url("black_on_white.png") repeat;
|
||||
background-size: 512px;
|
||||
font-family: "Roboto", sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.errorlist {
|
||||
|
||||
}
|
BIN
Website/users/static/users/white_on_blue.png
Normal file
BIN
Website/users/static/users/white_on_blue.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
27
Website/users/templates/users/base.html
Normal file
27
Website/users/templates/users/base.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{% load static %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'users/styles.css' %}">
|
||||
|
||||
<title>SkoolOS</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
a
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
16
Website/users/templates/users/login.html
Normal file
16
Website/users/templates/users/login.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
{% block content %}
|
||||
<div class="login-page">
|
||||
<div class="form">
|
||||
<form class="login-form" method="POST">
|
||||
{% csrf_token %}
|
||||
{{ form | crispy }}
|
||||
<button type="submit">login</button>
|
||||
<p class="message">Not registered? <a href="#">Create an account with Ionreg</a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
15
Website/users/templates/users/register.html
Normal file
15
Website/users/templates/users/register.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
{% extends "users/base.html" %}\
|
||||
|
||||
{% block content %}
|
||||
<div class="login-page">
|
||||
<div class="form">
|
||||
<form class="login-form" method="POST">
|
||||
{% csrf_token %}
|
||||
{{ form | crispy }}
|
||||
<button type="submit">login</button>
|
||||
<p class="message">Not registered? <a href="#">Create an account with Ionreg</a></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
3
Website/users/tests.py
Normal file
3
Website/users/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
Website/users/views.py
Normal file
3
Website/users/views.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
BIN
chromedriver-mac
Executable file
BIN
chromedriver-mac
Executable file
Binary file not shown.
0
eharris1/APLit_eharris1/Cuisine_APLit/instruct.txt
Normal file
0
eharris1/APLit_eharris1/Cuisine_APLit/instruct.txt
Normal file
0
eharris1/APLit_eharris1/Cuisine_APLit/rubric.txt
Normal file
0
eharris1/APLit_eharris1/Cuisine_APLit/rubric.txt
Normal file
0
eharris1/APLit_eharris1/Essay2_APLit/rubric.txt
Normal file
0
eharris1/APLit_eharris1/Essay2_APLit/rubric.txt
Normal file
0
eharris1/APLit_eharris1/README.md
Normal file
0
eharris1/APLit_eharris1/README.md
Normal file
0
eharris1/APLit_eharris1/Test1_APLit/instruct.txt
Normal file
0
eharris1/APLit_eharris1/Test1_APLit/instruct.txt
Normal file
1
eharris1/English11_eharris1/Journal1_English11/entry.txt
Normal file
1
eharris1/English11_eharris1/Journal1_English11/entry.txt
Normal file
|
@ -0,0 +1 @@
|
|||
|
|
@ -4,6 +4,7 @@ chardet==3.0.4
|
|||
click==7.1.2
|
||||
Django==3.0.7
|
||||
django-cors-middleware==1.5.0
|
||||
django-crispy-forms==1.9.1
|
||||
django-oauth-toolkit==1.3.2
|
||||
djangorestframework==3.11.0
|
||||
idna==2.9
|
||||
|
|
Loading…
Reference in New Issue
Block a user