mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-16 02:10:19 -04:00
basicc cli cocmpleted
This commit is contained in:
parent
9fa43809cb
commit
6056bc6e11
|
@ -227,17 +227,18 @@ class Student:
|
||||||
os.system(url)
|
os.system(url)
|
||||||
|
|
||||||
cdir = os.getcwd()
|
cdir = os.getcwd()
|
||||||
path1 = self.username + "/" + self.username
|
os.chdir(self.username)
|
||||||
path2 = self.username
|
# path1 = self.username + "/" + self.username
|
||||||
if(os.path.isdir(path1)):
|
# path2 = self.username
|
||||||
os.chdir(path1)
|
# if(os.path.isdir(path1)):
|
||||||
else:
|
# os.chdir(path1)
|
||||||
os.chdir(self.username)
|
# else:
|
||||||
command("git clone " + self.repo)
|
# os.chdir(self.username)
|
||||||
os.chdir(self.username)
|
# command("git clone " + self.repo)
|
||||||
|
# os.chdir(self.username)
|
||||||
|
|
||||||
#push to git, start at master
|
#push to git, start at master
|
||||||
os.chdir(self.username)
|
#os.chdir(self.username)
|
||||||
command("git checkout master")
|
command("git checkout master")
|
||||||
command("git branch " + data['name'])
|
command("git branch " + data['name'])
|
||||||
command("git commit -m initial")
|
command("git commit -m initial")
|
||||||
|
@ -335,7 +336,7 @@ class Student:
|
||||||
if c['name'] == courses:
|
if c['name'] == courses:
|
||||||
command("git checkout " + courses)
|
command("git checkout " + courses)
|
||||||
print(os.listdir())
|
print(os.listdir())
|
||||||
break
|
return
|
||||||
os.chdir(cdir)
|
os.chdir(cdir)
|
||||||
print("Class not found")
|
print("Class not found")
|
||||||
return
|
return
|
||||||
|
|
50
skoolos.py
50
skoolos.py
|
@ -47,12 +47,29 @@ def main():
|
||||||
#webbrowser.open("http://127.0.0.1:8000/login", new=2)
|
#webbrowser.open("http://127.0.0.1:8000/login", new=2)
|
||||||
authenticate()
|
authenticate()
|
||||||
else:
|
else:
|
||||||
try:
|
profiles = os.listdir()
|
||||||
f = open('.tprofile','r')
|
users = []
|
||||||
except:
|
info = []
|
||||||
f = open('.sprofile','r')
|
count = 1
|
||||||
data = json.loads(f.read())
|
for i in range(len(profiles)):
|
||||||
f.close()
|
p = profiles[i]
|
||||||
|
if('profile' in p):
|
||||||
|
f = open(p,'r')
|
||||||
|
d = json.loads(f.read())
|
||||||
|
f.close()
|
||||||
|
info.append(d)
|
||||||
|
users.append(str(count) + ") " + d['username'])
|
||||||
|
count = count+1
|
||||||
|
user = [
|
||||||
|
{
|
||||||
|
'type': 'list',
|
||||||
|
'name': 'user',
|
||||||
|
'choices':users,
|
||||||
|
'message': 'Select User: ',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
u = int(prompt(user)['user'].split(")")[0]) -1
|
||||||
|
data = info[u]
|
||||||
PWD = data['password']
|
PWD = data['password']
|
||||||
USER = data['username']
|
USER = data['username']
|
||||||
print(data['username'])
|
print(data['username'])
|
||||||
|
@ -68,6 +85,7 @@ def studentCLI(user, password):
|
||||||
from CLI import student
|
from CLI import student
|
||||||
data = getUser(user, password, 'student')
|
data = getUser(user, password, 'student')
|
||||||
student = student.Student(data)
|
student = student.Student(data)
|
||||||
|
student.update()
|
||||||
carray = student.sclass.split(",")
|
carray = student.sclass.split(",")
|
||||||
if(len(carray) == 1 and carray[0] == ""):
|
if(len(carray) == 1 and carray[0] == ""):
|
||||||
print("No classes")
|
print("No classes")
|
||||||
|
@ -90,6 +108,10 @@ def studentCLI(user, password):
|
||||||
student.viewClass(course)
|
student.viewClass(course)
|
||||||
student.getAssignments(course, 100)
|
student.getAssignments(course, 100)
|
||||||
|
|
||||||
|
################################################ STUDENT METHODS
|
||||||
|
|
||||||
|
################################################ TEACHER METHODS
|
||||||
|
|
||||||
def teacherCLI(user, password):
|
def teacherCLI(user, password):
|
||||||
from CLI import teacher
|
from CLI import teacher
|
||||||
data = getUser(user, password, 'teacher')
|
data = getUser(user, password, 'teacher')
|
||||||
|
@ -157,7 +179,7 @@ def teacherCLI(user, password):
|
||||||
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(s, course)
|
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", "Exit"]
|
||||||
questions = [
|
questions = [
|
||||||
{
|
{
|
||||||
'type': 'list',
|
'type': 'list',
|
||||||
|
@ -206,7 +228,7 @@ def teacherCLI(user, password):
|
||||||
students = f.read().splitlines()
|
students = f.read().splitlines()
|
||||||
teacher.reqAddStudentList(students, course)
|
teacher.reqAddStudentList(students, course)
|
||||||
else:
|
else:
|
||||||
sys.exit()
|
sys.exit(0)
|
||||||
if(option == '2'):
|
if(option == '2'):
|
||||||
nlist = os.listdir(teacher.username + "/" + course)
|
nlist = os.listdir(teacher.username + "/" + course)
|
||||||
alist = getDB("http://localhost:8000/api/classes/" + course)['assignments']
|
alist = getDB("http://localhost:8000/api/classes/" + course)['assignments']
|
||||||
|
@ -241,8 +263,18 @@ def teacherCLI(user, password):
|
||||||
ass = prompt(questions)['assignment']
|
ass = prompt(questions)['assignment']
|
||||||
apath = teacher.username + "/" + course + "/" + ass
|
apath = teacher.username + "/" + course + "/" + ass
|
||||||
due = input("Enter due date (Example: 2020-08-11 16:58): ")
|
due = input("Enter due date (Example: 2020-08-11 16:58): ")
|
||||||
due = due + ":00.000000"
|
due = due + ":33.383124"
|
||||||
due = due.strip()
|
due = due.strip()
|
||||||
|
f = False
|
||||||
|
while(not f):
|
||||||
|
try:
|
||||||
|
datetime.datetime.strptime(due, '%Y-%m-%d %H:%M:%S.%f')
|
||||||
|
f = True
|
||||||
|
except:
|
||||||
|
print("Due-date format is incorrect.")
|
||||||
|
print(due)
|
||||||
|
due = input("Enter due date (Example: 2020-08-11 16:58): ")
|
||||||
|
due = due + ":33.383124"
|
||||||
teacher.addAssignment(apath, course, due)
|
teacher.addAssignment(apath, course, due)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user