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
Conflicts: CLI/student.py CLI/teacher.py
This commit is contained in:
commit
d256ed6036
|
@ -29,35 +29,34 @@ def getStudent(ion_user):
|
||||||
return None
|
return None
|
||||||
print(r.status_code)
|
print(r.status_code)
|
||||||
|
|
||||||
|
#makes a GET request to given url, returns dict
|
||||||
def getDB(url):
|
def getDB(url):
|
||||||
r = requests.get(url=url, auth=('raffukhondaker', 'hackgroup1'))
|
r = requests.get(url=url, auth=('raffukhondaker', 'hackgroup1'))
|
||||||
print("GET:" + str(r.status_code))
|
print("GET:" + str(r.status_code))
|
||||||
return (r.json())
|
return (r.json())
|
||||||
|
|
||||||
|
#makes a PATCH (updates instance) request to given url, returns dict
|
||||||
|
def patchDB(data, url):
|
||||||
|
r = requests.patch(url = url, data=data, auth=('raffukhondaker','hackgroup1'))
|
||||||
|
print("PATCH:" + str(r.status_code))
|
||||||
|
return(r.json())
|
||||||
|
|
||||||
|
#makes a POST (makes new instance) request to given url, returns dict
|
||||||
def postDB(data, url):
|
def postDB(data, url):
|
||||||
r = requests.post(url=url, data=data, auth=('raffukhondaker', 'hackgroup1'))
|
r = requests.post(url=url, data=data, auth=('raffukhondaker', 'hackgroup1'))
|
||||||
print("POST:" + str(r.status_code))
|
print("POST:" + str(r.status_code))
|
||||||
return (r.json())
|
return (r.json())
|
||||||
|
|
||||||
|
#makes a PUT (overwrites instance) request to given url, returns dict
|
||||||
def putDB(data, url):
|
def putDB(data, url):
|
||||||
r = requests.put(url=url, data=data, auth=('raffukhondaker', 'hackgroup1'))
|
r = requests.put(url=url, data=data, auth=('raffukhondaker', 'hackgroup1'))
|
||||||
print("PUT:" + str(r.status_code))
|
print("PUT:" + str(r.status_code))
|
||||||
return (r.json())
|
return (r.json())
|
||||||
|
|
||||||
|
#makes a DELETE (delete instance) request to given url, returns dict
|
||||||
def patchDB(data, url):
|
|
||||||
r = requests.patch(url=url, data=data, auth=('raffukhondaker', 'hackgroup1'))
|
|
||||||
print("PATH:" + str(r.status_code))
|
|
||||||
return (r.json())
|
|
||||||
|
|
||||||
|
|
||||||
def delDB(url):
|
def delDB(url):
|
||||||
r = requests.delete(url=url, auth=('raffukhondaker', 'hackgroup1'))
|
r = requests.delete(url=url, auth=('raffukhondaker', 'hackgroup1'))
|
||||||
print("DELETE:" + str(r.status_code))
|
print("DELETE:" + str(r.status_code))
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def command(command):
|
def command(command):
|
||||||
|
|
|
@ -47,7 +47,7 @@ def getTeacher(ion_user):
|
||||||
return None
|
return None
|
||||||
print(r.status_code)
|
print(r.status_code)
|
||||||
|
|
||||||
|
#makes a GET request to given url, returns dict
|
||||||
def getDB(url):
|
def getDB(url):
|
||||||
"""
|
"""
|
||||||
Sends a GET request to the URL
|
Sends a GET request to the URL
|
||||||
|
@ -55,9 +55,9 @@ def getDB(url):
|
||||||
"""
|
"""
|
||||||
r = requests.get(url=url, auth=('raffukhondaker', 'hackgroup1'))
|
r = requests.get(url=url, auth=('raffukhondaker', 'hackgroup1'))
|
||||||
print("GET:" + str(r.status_code))
|
print("GET:" + str(r.status_code))
|
||||||
return r.json()
|
return(r.json())
|
||||||
|
|
||||||
|
|
||||||
|
#makes a PATCH (updates instance) request to given url, returns dict
|
||||||
def patchDB(data, url):
|
def patchDB(data, url):
|
||||||
"""
|
"""
|
||||||
Sends a PATCH request to the URL
|
Sends a PATCH request to the URL
|
||||||
|
@ -69,6 +69,7 @@ def patchDB(data, url):
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
||||||
|
|
||||||
|
#makes a POST (makes new instance) request to given url, returns dict
|
||||||
def postDB(data, url):
|
def postDB(data, url):
|
||||||
"""
|
"""
|
||||||
Sends a POST request to the URL
|
Sends a POST request to the URL
|
||||||
|
@ -80,6 +81,7 @@ def postDB(data, url):
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
||||||
|
|
||||||
|
#makes a PUT (overwrites instance) request to given url, returns dict
|
||||||
def putDB(data, url):
|
def putDB(data, url):
|
||||||
"""
|
"""
|
||||||
Sends a PUT request to the URL
|
Sends a PUT request to the URL
|
||||||
|
@ -91,6 +93,7 @@ def putDB(data, url):
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
||||||
|
|
||||||
|
#makes a DELETE (delete instance) request to given url, returns dict
|
||||||
def delDB(url):
|
def delDB(url):
|
||||||
"""
|
"""
|
||||||
Sends a DELETE request to the URL
|
Sends a DELETE request to the URL
|
||||||
|
@ -208,13 +211,14 @@ class Teacher:
|
||||||
}
|
}
|
||||||
# make class instance in db
|
# make class instance in db
|
||||||
postDB(data, 'http://127.0.0.1:8000/api/classes/')
|
postDB(data, 'http://127.0.0.1:8000/api/classes/')
|
||||||
|
time.sleep(1)
|
||||||
self.classes.append(cname)
|
self.classes.append(cname)
|
||||||
# add to instance
|
# add to instance
|
||||||
# update self.classes
|
# update self.classes
|
||||||
data = {
|
data = {
|
||||||
'classes': self.classes
|
'classes': self.classes
|
||||||
}
|
}
|
||||||
print(self.username)
|
print(self.classes)
|
||||||
print(patchDB(data, 'http://127.0.0.1:8000/api/teachers/' + self.username + "/"))
|
print(patchDB(data, 'http://127.0.0.1:8000/api/teachers/' + self.username + "/"))
|
||||||
|
|
||||||
# make a new class from scratch
|
# make a new class from scratch
|
||||||
|
|
0
eharris1/Art12_eharris1/Painting1/rubric.txt
Normal file
0
eharris1/Art12_eharris1/Painting1/rubric.txt
Normal file
0
eharris1/Art12_eharris1/README.md
Normal file
0
eharris1/Art12_eharris1/README.md
Normal file
0
eharris1/English11_eharris1/README.md
Normal file
0
eharris1/English11_eharris1/README.md
Normal file
26
skoolos.py
26
skoolos.py
|
@ -100,9 +100,11 @@ def teacherCLI(user, password):
|
||||||
# 3. Get progress logs on a student
|
# 3. Get progress logs on a student
|
||||||
# 2. make an assignment for a class
|
# 2. make an assignment for a class
|
||||||
# 3. view student submissions for an assignment
|
# 3. view student submissions for an assignment
|
||||||
carray = teacher.classes
|
carray = []
|
||||||
carray.append("Exit SkoolOS")
|
for c in teacher.classes:
|
||||||
|
carray.append(c)
|
||||||
carray.append("Make New Class")
|
carray.append("Make New Class")
|
||||||
|
carray.append("Exit SkoolOS")
|
||||||
courses = [
|
courses = [
|
||||||
{
|
{
|
||||||
'type': 'list',
|
'type': 'list',
|
||||||
|
@ -119,10 +121,11 @@ def teacherCLI(user, password):
|
||||||
{
|
{
|
||||||
'type': 'input',
|
'type': 'input',
|
||||||
'name': 'cname',
|
'name': 'cname',
|
||||||
'message': 'Class Name: ',
|
'message': 'Class Name (Must be: <subject>_<ion_user>): ',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
cname = prompt(questions)['cname']
|
cname = prompt(questions)['cname']
|
||||||
|
print(cname)
|
||||||
teacher.makeClass(cname)
|
teacher.makeClass(cname)
|
||||||
soption = ["1) Add individual student", "2) Add list of students through path", "3) Exit"]
|
soption = ["1) Add individual student", "2) Add list of students through path", "3) Exit"]
|
||||||
questions = [
|
questions = [
|
||||||
|
@ -130,7 +133,7 @@ def teacherCLI(user, password):
|
||||||
'type': 'list',
|
'type': 'list',
|
||||||
'choices':soption,
|
'choices':soption,
|
||||||
'name': 'students',
|
'name': 'students',
|
||||||
'message': 'Add list of students (input path): ',
|
'message': 'Add Students): ',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
choice = prompt(questions)['students'].split(")")[0]
|
choice = prompt(questions)['students'].split(")")[0]
|
||||||
|
@ -138,15 +141,22 @@ def teacherCLI(user, password):
|
||||||
s = input("Student name: ")
|
s = input("Student name: ")
|
||||||
teacher.addStudent(s, cname)
|
teacher.addStudent(s, cname)
|
||||||
if("2" == choice):
|
if("2" == choice):
|
||||||
p = input("Relativee Path: ")
|
print("File must be .txt and have 1 student username per line")
|
||||||
if(os.path.exists(p)):
|
path = input("Relative Path: ")
|
||||||
print(p + " does not exist.")
|
while(not os.path.exists(path)):
|
||||||
|
if(path == 'N'):
|
||||||
|
sys.exit(0)
|
||||||
|
print(path + " is not a valid path")
|
||||||
|
path = input("Enter file path ('N' to exit): ")
|
||||||
|
f = open(path, 'r')
|
||||||
|
students = f.read().splitlines()
|
||||||
|
teacher.reqAddStudentList(students, cname)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Class: " + course)
|
print("Class: " + course)
|
||||||
unconf = getDB("http://localhost:8000/api/classes/" + course)['unconfirmed']
|
unconf = getDB("http://localhost:8000/api/classes/" + course)['unconfirmed']
|
||||||
for s in unconf:
|
for s in unconf:
|
||||||
teacher.addStudent()
|
teacher.addStudent(s, course)
|
||||||
options = ['1) Request Student', "2) Add assignment", "3) View student information"]
|
options = ['1) Request Student', "2) Add assignment", "3) View student information"]
|
||||||
questions = [
|
questions = [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user