diff --git a/CLI/student.py b/CLI/student.py index 5d6ad51..8559979 100644 --- a/CLI/student.py +++ b/CLI/student.py @@ -186,6 +186,7 @@ class Student: print("ADDING CLASS: " + str(c['name'])) self.addClass(str(c['name'])) command("git checkout master") + print(os.getcwd()) #updates 1 class, does not switch to master def updateClass(self, course): @@ -222,14 +223,14 @@ class Student: os.system(url) cdir = os.getcwd() - # path1 = self.username + "/" + self.username - # path2 = self.username - # if(os.path.isdir(path1)): - # os.chdir(path1) - # else: - # os.chdir(self.username) - # command("git clone " + self.repo) - # os.chdir(self.username) + path1 = self.username + "/" + self.username + path2 = self.username + if(os.path.isdir(path1)): + os.chdir(path1) + else: + os.chdir(self.username) + command("git clone " + self.repo) + os.chdir(self.username) #push to git, start at master os.chdir(self.username) @@ -277,6 +278,7 @@ class Student: data={ 'user':self.user, 'added_to':self.snew, + 'classes':self.sclass } print(self.url) print(patchDB(data, self.url)) @@ -366,15 +368,14 @@ class Student: command('git checkout master') os.chdir(cdir) -# data = getStudent("2022rkhondak") -# s = Student(data) -# #s.viewClass("APLit_eharris1") -# #s.updateClass("APLit_eharris1") +data = getStudent("2022rkhondak") +s = Student(data) +#s.viewClass("APLit_eharris1") +s.addClass("APLit_eharris1") # #s.update() # s.exitCLI() def main(): - print("noooo") pass if __name__ == "__main__": diff --git a/CLI/teacher.py b/CLI/teacher.py index a08debb..b062c15 100644 --- a/CLI/teacher.py +++ b/CLI/teacher.py @@ -332,24 +332,23 @@ class Teacher: command('git push -u origin ' + cname) os.chdir(cdir) - if(course['confirmed']==""): + if(course['confirmed']==[]): course['confirmed']=student['ion_user'] else: - course['confirmed']=course['confirmed']+ "," + student['ion_user'] + course['confirmed'].append(student['ion_user']) #only 1 pereson on confirmeed - if(("," in course['unconfirmed']) == False): - course['unconfirmed']="" + if(len(course['unconfirmed']) == 1): + course['unconfirmed']=[] #mutiple else: - course['unconfirmed']= course['unconfirmed'].replace("," + student['ion_user'], "") - course['unconfirmed']= course['unconfirmed'].replace(student['ion_user']+",", "") + course['unconfirmed'].remove(student['ion_user']) cinfo = { "confirmed": course["confirmed"], "unconfirmed": course['unconfirmed'] } - print(patchDB(cinfo, "http://localhost:8000/api/classes/" + course['name'] + "/")) + print(putDB(course, "http://localhost:8000/api/classes/" + course['name'] + "/")) return True #goes through list of studennts, tries to add, then request, return unconfirmed students @@ -436,15 +435,12 @@ class Teacher: 'due_date':due } postDB(ass, 'http://127.0.0.1:8000/api/assignments/') - if(course['assignments'] == ""): - course['assignments'] = ass - else: - course['assignments'] = course['assignments'].append(ass) + course['assignments'].append(aname) cinfo = { "assignments": course['assignments'], } - patchDB(cinfo, "http://127.0.0.1:8000/api/classes/" + course['name'] + "/") + print(patchDB(cinfo, "http://127.0.0.1:8000/api/classes/" + course['name'] + "/")) return True else: print("Assignment already addedd") @@ -606,7 +602,7 @@ t = Teacher(data) #ar = ['2022rkhondak','2022inafi','2023rumareti'] #extra = t.reqAddStudentList(ar, "APLit_eharris1") #print(extra) -t.reqStudent('2022rkhondak', 'APLit_eharris1') +#t.addStudent('2022rkhondak', 'APLit_eharris1') # t.getChanges('2022rkhondak','APLit_eharris1', 10) ''' diff --git a/requirements.txt b/requirements.txt index 39bd1f5..27546fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,62 +1,81 @@ appdirs==1.4.3 -asgiref==3.2.7 -astroid==2.4.2 -CacheControl==0.12.6 -certifi==2020.4.5.1 -chardet==3.0.4 +cachecontrol==0.12.6 click==7.1.2 colorama==0.4.3 contextlib2==0.6.0 distlib==0.3.0 distro==1.4.0 -Django==3.0.7 django-cors-middleware==1.5.0 django-crispy-forms==1.9.1 +django-forms-bootstrap==3.1.0 django-oauth-toolkit==1.3.2 +django-request-token==0.10.1 djangorestframework==3.11.0 -greenlet==0.4.16 +hashids==1.2.0 html5lib==1.0.1 -idna==2.9 -isort==4.3.21 -lazy-object-proxy==1.4.3 -mccabe==0.6.1 meson==0.53.2 -msgpack==0.6.2 numpy==1.18.5 -oauthlib==3.1.0 ordered-set==3.1.1 -packaging==20.1 pep517==0.8.1 -Pillow==7.1.2 +pip-chill==1.0.0 progress==1.5 -prompt-toolkit==1.0.14 pulsemixer==1.5.0 pycairo==1.19.1 pyclipper==1.1.0.post3 -Pygments==2.6.1 -PyGObject==3.34.0 pyinotify==0.9.6 -PyInquirer==1.0.3 +pyinquirer==1.0.3 pylint==2.5.3 pynvim==0.4.1 -pyparsing==2.4.6 pyperclip==1.8.0 pytoml==0.1.21 -pytz==2020.1 -pywal==3.3.0 -regex==2020.5.14 -requests==2.23.0 +requests-oauth==0.4.1 requests-oauthlib==1.3.0 retrying==1.3.3 selenium==3.141.0 -six==1.15.0 -sqlparse==0.3.1 -toml==0.10.0 -urllib3==1.25.9 -wcwidth==0.2.3 -webencodings==0.5.1 -Werkzeug==1.0.1 +sphinx==3.1.1 +werkzeug==1.0.1 wpgtk==6.1.3 -wrapt==1.12.1 yapf==0.30.0 - +# alabaster==0.7.12 # Installed as dependency for sphinx +# asgiref==3.2.7 # Installed as dependency for django +# astroid==2.4.2 # Installed as dependency for pylint +# babel==2.8.0 # Installed as dependency for sphinx +# certifi==2020.4.5.1 # Installed as dependency for requests +# chardet==3.0.4 # Installed as dependency for requests +# django==3.0.7 # Installed as dependency for django-request-token, djangorestframework, django-oauth-toolkit +# docutils==0.16 # Installed as dependency for sphinx +# greenlet==0.4.16 # Installed as dependency for pynvim +# idna==2.9 # Installed as dependency for requests +# imagesize==1.2.0 # Installed as dependency for sphinx +# isort==4.3.21 # Installed as dependency for pylint +# jinja2==2.11.2 # Installed as dependency for sphinx +# lazy-object-proxy==1.4.3 # Installed as dependency for astroid +# markupsafe==1.1.1 # Installed as dependency for jinja2 +# mccabe==0.6.1 # Installed as dependency for pylint +# msgpack==0.6.2 # Installed as dependency for pynvim, cachecontrol +# oauthlib==3.1.0 # Installed as dependency for requests-oauthlib, django-oauth-toolkit +# packaging==20.1 # Installed as dependency for sphinx +# pillow==7.1.2 # Installed as dependency for wpgtk +# prompt-toolkit==1.0.14 # Installed as dependency for pyinquirer +# psycopg2-binary==2.8.5 # Installed as dependency for django-request-token +# pygments==2.6.1 # Installed as dependency for sphinx, pyinquirer +# pyjwt==1.7.1 # Installed as dependency for django-request-token +# pyparsing==2.4.6 # Installed as dependency for packaging +# pytz==2020.1 # Installed as dependency for django, babel +# pywal==3.3.0 # Installed as dependency for wpgtk +# regex==2020.5.14 # Installed as dependency for pyinquirer +# requests==2.23.0 # Installed as dependency for cachecontrol, requests-oauth, django-oauth-toolkit, sphinx, requests-oauthlib +# six==1.15.0 # Installed as dependency for astroid, prompt-toolkit, html5lib, retrying, packaging +# snowballstemmer==2.0.0 # Installed as dependency for sphinx +# sphinxcontrib-applehelp==1.0.2 # Installed as dependency for sphinx +# sphinxcontrib-devhelp==1.0.2 # Installed as dependency for sphinx +# sphinxcontrib-htmlhelp==1.0.3 # Installed as dependency for sphinx +# sphinxcontrib-jsmath==1.0.1 # Installed as dependency for sphinx +# sphinxcontrib-qthelp==1.0.3 # Installed as dependency for sphinx +# sphinxcontrib-serializinghtml==1.1.4 # Installed as dependency for sphinx +# sqlparse==0.3.1 # Installed as dependency for django, django-request-token +# toml==0.10.0 # Installed as dependency for pylint, pep517 +# urllib3==1.25.9 # Installed as dependency for selenium, requests +# wcwidth==0.2.3 # Installed as dependency for prompt-toolkit +# webencodings==0.5.1 # Installed as dependency for html5lib +# wrapt==1.12.1 # Installed as dependency for astroid