teacher fix final

This commit is contained in:
Raffu Khondaker 2020-06-09 18:02:13 -04:00
parent fc88e6c4c9
commit 7c8ae8ad33

View File

@ -6,7 +6,7 @@ import pprint
import json import json
import shutil import shutil
import time import time
import prompt_toolkit.clipboard.pyperclip import pyperclip
#git clone student directory ==> <student-id>/classes/assignments #git clone student directory ==> <student-id>/classes/assignments
@ -199,7 +199,6 @@ class Teacher:
input("Make new Git Repo with name: " + cname + " (Press any key to continue)\n") input("Make new Git Repo with name: " + cname + " (Press any key to continue)\n")
try: try:
pyperclip.copy(cname) pyperclip.copy(cname)
spam = pyperclip.paste()
print(cname + " copied to clipboard.") print(cname + " copied to clipboard.")
except: except:
pass pass
@ -241,7 +240,6 @@ class Teacher:
#make class from existing directory, add to git and api #make class from existing directory, add to git and api
def addClass(self, path): def addClass(self, path):
if (self.checkClass(path)): if (self.checkClass(path)):
data = self.addClasstoGit(path) data = self.addClasstoGit(path)
#make class instance in db #make class instance in db
@ -311,7 +309,6 @@ class Teacher:
if cname == c['name']: if cname == c['name']:
cid = str(c['id']) cid = str(c['id'])
repo = c['repo'] repo = c['repo']
print(cid)
#remove from api #remove from api
for i in range(len(self.classes)): for i in range(len(self.classes)):
@ -319,8 +316,9 @@ class Teacher:
print("DELETE: " + self.classes[i]['name']) print("DELETE: " + self.classes[i]['name'])
del self.classes[i] del self.classes[i]
s="" s=""
#recreate sclass field, using ids
for c in self.classes: for c in self.classes:
s = s + str(self.classes[i]['id']) + "," s = s + str(c['id']) + ","
print(s) print(s)
s = s[:-1] s = s[:-1]
print(s) print(s)
@ -364,5 +362,5 @@ class Teacher:
data = getTeacher("eharris1") data = getTeacher("eharris1")
t = Teacher(data) t = Teacher(data)
t.deleteClass("eharris1/Crypto_eharris1") t.makeClass('English11_eharris1', ["Essay1"])
t.update() t.update()