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
|
||||
print(r.status_code)
|
||||
|
||||
#makes a GET request to given url, returns dict
|
||||
def getDB(url):
|
||||
r = requests.get(url = url, auth=('raffukhondaker','hackgroup1'))
|
||||
print("GET:" + str(r.status_code))
|
||||
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):
|
||||
r = requests.post(url = url, data=data, auth=('raffukhondaker','hackgroup1'))
|
||||
print("POST:" + str(r.status_code))
|
||||
return(r.json())
|
||||
|
||||
#makes a PUT (overwrites instance) request to given url, returns dict
|
||||
def putDB(data, url):
|
||||
r = requests.put(url = url, data=data, auth=('raffukhondaker','hackgroup1'))
|
||||
print("PUT:" + str(r.status_code))
|
||||
return(r.json())
|
||||
|
||||
#makes a DELETE (delete instance) request to given url, returns dict
|
||||
def delDB(url):
|
||||
r = requests.delete(url = url, auth=('raffukhondaker','hackgroup1'))
|
||||
print("DELETE:" + str(r.status_code))
|
||||
|
@ -167,13 +173,14 @@ class Teacher:
|
|||
}
|
||||
#make class instance in db
|
||||
postDB(data, 'http://127.0.0.1:8000/api/classes/')
|
||||
time.sleep(1)
|
||||
self.classes.append(cname)
|
||||
#add to instance
|
||||
#upate self.classes
|
||||
data = {
|
||||
'classes':self.classes
|
||||
}
|
||||
print(self.username)
|
||||
print(self.classes)
|
||||
print(patchDB(data, 'http://127.0.0.1:8000/api/teachers/' + self.username + "/"))
|
||||
|
||||
#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
|
||||
# 2. make an assignment for a class
|
||||
# 3. view student submissions for an assignment
|
||||
carray = teacher.classes
|
||||
carray.append("Exit SkoolOS")
|
||||
carray = []
|
||||
for c in teacher.classes:
|
||||
carray.append(c)
|
||||
carray.append("Make New Class")
|
||||
carray.append("Exit SkoolOS")
|
||||
courses = [
|
||||
{
|
||||
'type': 'list',
|
||||
|
@ -119,10 +121,11 @@ def teacherCLI(user, password):
|
|||
{
|
||||
'type': 'input',
|
||||
'name': 'cname',
|
||||
'message': 'Class Name: ',
|
||||
'message': 'Class Name (Must be: <subject>_<ion_user>): ',
|
||||
},
|
||||
]
|
||||
cname = prompt(questions)['cname']
|
||||
print(cname)
|
||||
teacher.makeClass(cname)
|
||||
soption = ["1) Add individual student", "2) Add list of students through path", "3) Exit"]
|
||||
questions = [
|
||||
|
@ -130,7 +133,7 @@ def teacherCLI(user, password):
|
|||
'type': 'list',
|
||||
'choices':soption,
|
||||
'name': 'students',
|
||||
'message': 'Add list of students (input path): ',
|
||||
'message': 'Add Students): ',
|
||||
},
|
||||
]
|
||||
choice = prompt(questions)['students'].split(")")[0]
|
||||
|
@ -138,15 +141,22 @@ def teacherCLI(user, password):
|
|||
s = input("Student name: ")
|
||||
teacher.addStudent(s, cname)
|
||||
if("2" == choice):
|
||||
p = input("Relativee Path: ")
|
||||
if(os.path.exists(p)):
|
||||
print(p + " does not exist.")
|
||||
print("File must be .txt and have 1 student username per line")
|
||||
path = input("Relative Path: ")
|
||||
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:
|
||||
print("Class: " + course)
|
||||
unconf = getDB("http://localhost:8000/api/classes/" + course)['unconfirmed']
|
||||
for s in unconf:
|
||||
teacher.addStudent()
|
||||
teacher.addStudent(s, course)
|
||||
options = ['1) Request Student', "2) Add assignment", "3) View student information"]
|
||||
questions = [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user