changes
This commit is contained in:
parent
2c42225f8b
commit
9bfab84aae
10
courses.py
10
courses.py
|
|
@ -235,7 +235,7 @@ def users_in_by_depts_live(depts=[], termid='181'):
|
||||||
courses_by_by_dept = {}
|
courses_by_by_dept = {}
|
||||||
students_by_by_dept = {}
|
students_by_by_dept = {}
|
||||||
|
|
||||||
all_c = getCoursesInTerm(termid,0,0)
|
all_c = getCoursesInTerm(termid,1,0)
|
||||||
codecs.open('cache/courses_in_term_%s.json' % termid,'w','utf-8').write( json.dumps(all_c,indent=2) )
|
codecs.open('cache/courses_in_term_%s.json' % termid,'w','utf-8').write( json.dumps(all_c,indent=2) )
|
||||||
for c in all_c:
|
for c in all_c:
|
||||||
#print(c['course_code'])
|
#print(c['course_code'])
|
||||||
|
|
@ -246,7 +246,7 @@ def users_in_by_depts_live(depts=[], termid='181'):
|
||||||
print("Getting enrollments for %s" % c['course_code'])
|
print("Getting enrollments for %s" % c['course_code'])
|
||||||
if d in courses_by_by_dept: courses_by_by_dept[d].append(c)
|
if d in courses_by_by_dept: courses_by_by_dept[d].append(c)
|
||||||
else: courses_by_by_dept[d] = [ c, ]
|
else: courses_by_by_dept[d] = [ c, ]
|
||||||
for u in course_enrollment_with_faculty(c['id']).values():
|
for u in course_enrollment_with_faculty(c['id'],1).values():
|
||||||
#if u['type'] != "StudentEnrollment": continue
|
#if u['type'] != "StudentEnrollment": continue
|
||||||
if not (d in students_by_by_dept):
|
if not (d in students_by_by_dept):
|
||||||
students_by_by_dept[d] = set()
|
students_by_by_dept[d] = set()
|
||||||
|
|
@ -2281,9 +2281,9 @@ def bulk_unenroll():
|
||||||
|
|
||||||
for enrollment in enrollments:
|
for enrollment in enrollments:
|
||||||
enrollment_id = enrollment['id']
|
enrollment_id = enrollment['id']
|
||||||
skiplist = ['51237','58362','237']
|
#skiplist = ['51237','58362','237']
|
||||||
if enrollment_id in skiplist:
|
#if enrollment_id in skiplist:
|
||||||
continue
|
# continue
|
||||||
|
|
||||||
# Set the headers and parameters for the DELETE API call
|
# Set the headers and parameters for the DELETE API call
|
||||||
api_url = f"{url}/api/v1/courses/{course_id}/enrollments/{enrollment_id}"
|
api_url = f"{url}/api/v1/courses/{course_id}/enrollments/{enrollment_id}"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ from os.path import exists, getmtime
|
||||||
from pipelines import sync_non_interactive, url, header, gp, dean
|
from pipelines import sync_non_interactive, url, header, gp, dean
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
|
|
||||||
|
from canvas_secrets import postgres_database, postgres_password, postgres_port, postgres_user, postgres_host
|
||||||
|
|
||||||
#########
|
#########
|
||||||
######### LOCAL DB
|
######### LOCAL DB
|
||||||
#########
|
#########
|
||||||
|
|
@ -20,11 +22,11 @@ CURSOR = ''
|
||||||
|
|
||||||
def db():
|
def db():
|
||||||
global CON,CURSOR
|
global CON,CURSOR
|
||||||
CON = psycopg2.connect(database="db",
|
CON = psycopg2.connect(database=postgres_database,
|
||||||
host="192.168.1.6",
|
host=postgres_host,
|
||||||
user="postgres",
|
user=postgres_user,
|
||||||
password="rolley34",
|
password=postgres_password,
|
||||||
port="5432")
|
port=postgres_port)
|
||||||
|
|
||||||
CURSOR = CON.cursor()
|
CURSOR = CON.cursor()
|
||||||
return CON,CURSOR
|
return CON,CURSOR
|
||||||
|
|
|
||||||
12
users.py
12
users.py
|
|
@ -2019,10 +2019,14 @@ def nlp_sample2():
|
||||||
|
|
||||||
def one_course_enrol():
|
def one_course_enrol():
|
||||||
|
|
||||||
users = '25730'.split()
|
users = input("user,ids,separated,by,commas> ").split(',')
|
||||||
course = '16459'
|
course = input("course id> ")
|
||||||
the_type = 'StudentEnrollment' # 'TeacherEnrollment' #
|
my_types = {1:'StudentEnrollment', 2:'TeacherEnrollment'}
|
||||||
u = url + '/api/v1/courses/%s/enrollments' % course
|
print(json.dumps(my_types,indent=2))
|
||||||
|
the_type = my_types[ int(input("enrollment type> ")) ]
|
||||||
|
# the_type = 'StudentEnrollment'
|
||||||
|
# the_type = 'TeacherEnrollment'
|
||||||
|
u = f"{url}/api/v1/courses/{course}/enrollments"
|
||||||
|
|
||||||
for user in users:
|
for user in users:
|
||||||
param = {
|
param = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue