mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-16 02:10:19 -04:00
comments
This commit is contained in:
parent
ea5bf7c071
commit
5a04441e9b
|
@ -40,25 +40,31 @@ 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):
|
||||||
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):
|
||||||
r = requests.patch(url = url, data=data, auth=('raffukhondaker','hackgroup1'))
|
r = requests.patch(url = url, data=data, auth=('raffukhondaker','hackgroup1'))
|
||||||
print("PATCH:" + str(r.status_code))
|
print("PATCH:" + str(r.status_code))
|
||||||
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):
|
||||||
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 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))
|
||||||
|
@ -167,13 +173,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
|
||||||
#upate self.classes
|
#upate 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