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 = {}
|
||||
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) )
|
||||
for c in all_c:
|
||||
#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'])
|
||||
if d in courses_by_by_dept: courses_by_by_dept[d].append(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 not (d in students_by_by_dept):
|
||||
students_by_by_dept[d] = set()
|
||||
|
|
@ -2281,9 +2281,9 @@ def bulk_unenroll():
|
|||
|
||||
for enrollment in enrollments:
|
||||
enrollment_id = enrollment['id']
|
||||
skiplist = ['51237','58362','237']
|
||||
if enrollment_id in skiplist:
|
||||
continue
|
||||
#skiplist = ['51237','58362','237']
|
||||
#if enrollment_id in skiplist:
|
||||
# continue
|
||||
|
||||
# Set the headers and parameters for the DELETE API call
|
||||
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 tabulate import tabulate
|
||||
|
||||
from canvas_secrets import postgres_database, postgres_password, postgres_port, postgres_user, postgres_host
|
||||
|
||||
#########
|
||||
######### LOCAL DB
|
||||
#########
|
||||
|
|
@ -20,11 +22,11 @@ CURSOR = ''
|
|||
|
||||
def db():
|
||||
global CON,CURSOR
|
||||
CON = psycopg2.connect(database="db",
|
||||
host="192.168.1.6",
|
||||
user="postgres",
|
||||
password="rolley34",
|
||||
port="5432")
|
||||
CON = psycopg2.connect(database=postgres_database,
|
||||
host=postgres_host,
|
||||
user=postgres_user,
|
||||
password=postgres_password,
|
||||
port=postgres_port)
|
||||
|
||||
CURSOR = CON.cursor()
|
||||
return CON,CURSOR
|
||||
|
|
|
|||
12
users.py
12
users.py
|
|
@ -2019,10 +2019,14 @@ def nlp_sample2():
|
|||
|
||||
def one_course_enrol():
|
||||
|
||||
users = '25730'.split()
|
||||
course = '16459'
|
||||
the_type = 'StudentEnrollment' # 'TeacherEnrollment' #
|
||||
u = url + '/api/v1/courses/%s/enrollments' % course
|
||||
users = input("user,ids,separated,by,commas> ").split(',')
|
||||
course = input("course id> ")
|
||||
my_types = {1:'StudentEnrollment', 2:'TeacherEnrollment'}
|
||||
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:
|
||||
param = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue