diff --git a/CLI/student.py b/CLI/student.py index ae61396..b44d3a6 100644 --- a/CLI/student.py +++ b/CLI/student.py @@ -112,6 +112,7 @@ class Student: self.completed = data['completed'] self.user = data['user'] self.password = password + self.completed = data['completed'] # classes in id form (Example: 4,5) # storing actual classes cid = data['classes'].split(",") @@ -385,12 +386,13 @@ class Student: command("git add .") command("git commit -m update") command('git checkout ' + course) - time.sleep(5) ass = os.listdir() + oname = '' inclass = False for a in ass: - if a == assignment: + if a in assignment: inclass = True + oname = a + "_" + course break if (inclass == False): print(assignment + " not an assignment of " + course) @@ -404,6 +406,11 @@ class Student: command("git tag " + assignment + "-final") command("git push -u origin " + course + " --tags") command('git checkout master') + self.completed = oname + "," + self.completed + data = { + 'completed': self.completed + } + patchDB(self.username, self.password, data, self.url) os.chdir(cdir) diff --git a/CLI/teacher.py b/CLI/teacher.py index 363d80c..88c0608 100644 --- a/CLI/teacher.py +++ b/CLI/teacher.py @@ -604,7 +604,7 @@ class Teacher: # pull student's work, no modifications def getStudents(self, course): - if not (course in self.sclass): + if not (course in str(self.classes)): print(course + " not a class.") return path = self.username + "/Students/" + course @@ -697,7 +697,7 @@ class Teacher: # 'classes':course # } log = self.getCommits(student, course, 30) - assignment['due_date'] = datetime.strptime(assignment['due_date'], '%Y-%m-%d %H:%M:%S.%f') + assignment['due_date'] = datetime.strptime(assignment['due_date'], '%Y-%m-%dT%H:%M:%S.%fZ') late = False cdir = os.getcwd() os.chdir(self.username + "/Students/" + course + "/" + student) diff --git a/eharris1/English12_eharris1/Essay1/instruct.txt b/eharris1/English12_eharris1/Essay1/instruct.txt new file mode 100644 index 0000000..e69de29 diff --git a/skoolos.py b/skoolos.py index ad7491b..704cef6 100644 --- a/skoolos.py +++ b/skoolos.py @@ -121,7 +121,7 @@ def chooseClassStudent(student): def classOptionsStudent(student, course): student.viewClass(course) student.getAssignments(course, 100) - choices = ["Save","Back","Exit SkoolOS"] + choices = ["Save","Submit assignment","Back","Exit SkoolOS"] options = [ { 'type': 'list', @@ -143,6 +143,33 @@ def classOptionsStudent(student, course): student.exitCLI() #exit cli return True + if(option == "Submit assignment"): + assignments = os.listdir(student.username) + tlist = [] + b = True + for a in assignments: + oname = a + "_" + course + a = student.username + "/" + a + if(os.path.isdir(a) and not "." in a and not oname in student.completed): + tlist.append(a) + assignments = tlist + assignments.append("Back") + print(assignments) + + options = [ + { + 'type': 'list', + 'name': 'submit', + 'choices':assignments, + 'message': 'Select: ', + }, + ] + ass = prompt(options)['submit'] + if(ass == "Back"): + return False + else: + student.submit(course, ass) + return False #################################################################################################### TEACHER METHODS @@ -166,6 +193,8 @@ def teacherCLI(user, password): EXIT = makeClassTeacher(teacher) #selected a class else: + #Pull confirmed students directory + teacher.getStudents(course) option = classOptionsTeacher(teacher, course) if(option == '1'): EXIT = addStudentsTeacher(teacher, course) @@ -362,13 +391,30 @@ def viewStudentsTeacher(teacher, course): for s in unconf: print(s) student = input("View student (Enter student's ion username): ") - while((not student in str(data['confirmed'])) or (not student in str(data['unconfirmed']))): + while((not student in str(data['confirmed'])) and (not student in str(data['unconfirmed']))): print("Student not affiliated with class") student = input("View student ('N' to exit): ") if student == 'N': - return True - print(getDB(teacher.username, teacher.password, "http://127.0.0.1:8000/api/students/" + student + "/")) + return False + sinfo = getDB(teacher.username, teacher.password, "http://127.0.0.1:8000/api/students/" + student + "/") + pprint.pprint(sinfo) + print("Confirmed: " + str(student in str(data['confirmed']))) + if(student in str(data['confirmed'])): + path = teacher.username + "/Students/" + course + "/" + student + print(student + "'s work: " + path) + fin = sinfo['completed'].split(",") + alist = [] + for f in fin: + if(course in f): + late = teacher.afterSubmit(course, f, student) + if(late): + s = f.split("_")[0] + " (LATE)" + else: + s = f.split("_")[0] + alist.append(s) + print("Has submitted: " + str(alist)) + #put log stuff ############################################################################################################################################