This commit is contained in:
parent
0e5a62472d
commit
19a628efab
88
courses.py
88
courses.py
|
|
@ -689,31 +689,34 @@ def xlist_ii(parasite_id,host_id,new_name,new_code):
|
||||||
xyz = 'y'
|
xyz = 'y'
|
||||||
#xyz = input("Perform cross list? Enter y for yes, n for no: ")
|
#xyz = input("Perform cross list? Enter y for yes, n for no: ")
|
||||||
if xyz != 'n':
|
if xyz != 'n':
|
||||||
uu = url + '/api/v1/courses/%s/sections' % parasite_id
|
try:
|
||||||
c_sect = fetch(uu)
|
uu = url + '/api/v1/courses/%s/sections' % parasite_id
|
||||||
#print(json.dumps(c_sect,indent=2))
|
c_sect = fetch(uu)
|
||||||
if len(c_sect) > 1:
|
#print(json.dumps(c_sect,indent=2))
|
||||||
print("* * * * Already Crosslisted!!")
|
if len(c_sect) > 1:
|
||||||
return
|
print("* * * * Already Crosslisted!!")
|
||||||
if not c_sect:
|
return
|
||||||
print("* * * * Already Crosslisted!!")
|
if not c_sect:
|
||||||
return
|
print("* * * * Already Crosslisted!!")
|
||||||
else:
|
return
|
||||||
parasite_sxn_id = str(c_sect[0]['id'])
|
else:
|
||||||
print("Parasite section id: ", parasite_sxn_id)
|
parasite_sxn_id = str(c_sect[0]['id'])
|
||||||
|
print("Parasite section id: ", parasite_sxn_id)
|
||||||
|
|
||||||
u = url + "/api/v1/sections/%s/crosslist/%s" % (parasite_sxn_id,host_id)
|
u = url + "/api/v1/sections/%s/crosslist/%s" % (parasite_sxn_id,host_id)
|
||||||
print(u)
|
print(u)
|
||||||
res = requests.post(u, headers = header)
|
res = requests.post(u, headers = header)
|
||||||
print(res.text)
|
print(res.text)
|
||||||
|
|
||||||
u3 = url + "/api/v1/courses/%s" % host_id
|
u3 = url + "/api/v1/courses/%s" % host_id
|
||||||
data = {'course[name]': new_name, 'course[course_code]': new_code}
|
data = {'course[name]': new_name, 'course[course_code]': new_code}
|
||||||
print(data)
|
print(data)
|
||||||
print(u3)
|
print(u3)
|
||||||
r3 = requests.put(u3, headers=header, params=data)
|
r3 = requests.put(u3, headers=header, params=data)
|
||||||
print(r3.text)
|
print(r3.text)
|
||||||
print("\n\n")
|
print("\n\n")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"\n\nSome sort of failure on {new_name}: {e}")
|
||||||
|
|
||||||
|
|
||||||
# Relevant stuff trying to see if its even being used or not
|
# Relevant stuff trying to see if its even being used or not
|
||||||
|
|
@ -1702,19 +1705,20 @@ def overview_start_dates():
|
||||||
|
|
||||||
def course_by_depts_terms(section=0):
|
def course_by_depts_terms(section=0):
|
||||||
|
|
||||||
get_fresh = 1
|
get_fresh = 0
|
||||||
TERM = 287
|
TERM = 291
|
||||||
WI_TERM = 286
|
WI_TERM = 290
|
||||||
DOING_WINTER_MOVES = 1
|
DOING_WINTER_MOVES = 1
|
||||||
SEM = "sp25"
|
|
||||||
|
|
||||||
make_changes = 1
|
SEM = "sp26"
|
||||||
do_all = 0
|
|
||||||
|
|
||||||
winter_start_day = 2
|
make_changes = 0
|
||||||
aviation_start_day = 9
|
do_all = 'a'
|
||||||
|
|
||||||
|
winter_start_day = 5
|
||||||
|
aviation_start_day = 7
|
||||||
nursing_start_day = 0
|
nursing_start_day = 0
|
||||||
spring_start_day = 27
|
spring_start_day = 26
|
||||||
|
|
||||||
# get list of online course shells
|
# get list of online course shells
|
||||||
if get_fresh:
|
if get_fresh:
|
||||||
|
|
@ -1743,18 +1747,18 @@ def course_by_depts_terms(section=0):
|
||||||
# try to find online shell matching this schedule entry
|
# try to find online shell matching this schedule entry
|
||||||
try:
|
try:
|
||||||
this_id = crn_to_canvasid[S['crn']]
|
this_id = crn_to_canvasid[S['crn']]
|
||||||
|
report_line = f" - {start} {d_start} - id: {this_id} - {S['code']} {S['crn']} {S['name']}"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"DIDN'T FIND CRN - {start} {d_start} - {S['code']} {S['crn']} {S['name']}" )
|
print(f"DIDN'T FIND CRN - {start} {d_start} - {S['code']} {S['crn']} {S['name']}" )
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print(f" - {start} {d_start} - id: {this_id} - {S['code']} {S['crn']} {S['name']}" )
|
|
||||||
if 1:
|
if 1:
|
||||||
#if d_start.month < 5 or d_start.month > 7:
|
#if d_start.month < 5 or d_start.month > 7:
|
||||||
# print(f" Ignoring {d_start}, starting too far away...")
|
# print(f" Ignoring {d_start}, starting too far away...")
|
||||||
# continue
|
# continue
|
||||||
|
|
||||||
if d_start.month == 1 and d_start.day == aviation_start_day:
|
if d_start.month == 1 and d_start.day == aviation_start_day:
|
||||||
print("- Aviation ", start, d_start, " - ", S['code'], " ", S['crn'] )
|
print(f"+ AVIAT {report_line}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
#if d_start.month == 1 and d_start.day == nursing_start_day:
|
#if d_start.month == 1 and d_start.day == nursing_start_day:
|
||||||
|
|
@ -1762,11 +1766,11 @@ def course_by_depts_terms(section=0):
|
||||||
# continue
|
# continue
|
||||||
|
|
||||||
if d_start.month == 1 and d_start.day == spring_start_day:
|
if d_start.month == 1 and d_start.day == spring_start_day:
|
||||||
print(" Ignoring, term start date" )
|
print(f" IGNORE {report_line}" )
|
||||||
continue
|
continue
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(" Adjust course start day?")
|
#print(f" Adjust course start day? {report_line}")
|
||||||
|
|
||||||
if make_changes:
|
if make_changes:
|
||||||
if do_all != 'a':
|
if do_all != 'a':
|
||||||
|
|
@ -1778,17 +1782,17 @@ def course_by_depts_terms(section=0):
|
||||||
'course[restrict_enrollments_to_course_dates]':True }
|
'course[restrict_enrollments_to_course_dates]':True }
|
||||||
u2 = f"https://gavilan.instructure.com:443/api/v1/courses/{this_id}"
|
u2 = f"https://gavilan.instructure.com:443/api/v1/courses/{this_id}"
|
||||||
r3 = requests.put(u2, headers=header, params=data)
|
r3 = requests.put(u2, headers=header, params=data)
|
||||||
print(" updated.. OK")
|
print(f"+ UPDATED {report_line}")
|
||||||
|
|
||||||
|
make_changes = 1
|
||||||
if DOING_WINTER_MOVES:
|
if DOING_WINTER_MOVES:
|
||||||
if d_start.month == 1 and d_start.day == winter_start_day:
|
if d_start.month == 1 and d_start.day == winter_start_day:
|
||||||
print("+ winter session: ", d_start, " - ", S['code'])
|
print(f"+ WINTER {report_line}")
|
||||||
data = {'course[term_id]':WI_TERM}
|
data = {'course[term_id]':WI_TERM}
|
||||||
u2 = "https://gavilan.instructure.com:443/api/v1/courses/%s" % crn_to_canvasid[S['crn']]
|
u2 = "https://gavilan.instructure.com:443/api/v1/courses/%s" % crn_to_canvasid[S['crn']]
|
||||||
if make_changes:
|
if make_changes:
|
||||||
r3 = requests.put(u2, headers=header, params=data)
|
r3 = requests.put(u2, headers=header, params=data)
|
||||||
print(" updated.. OK")
|
#print(" updated.. OK")
|
||||||
#print(r3.text)
|
#print(r3.text)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1804,8 +1808,8 @@ def xlist_cwe():
|
||||||
# cwe192 get put into another shell
|
# cwe192 get put into another shell
|
||||||
|
|
||||||
|
|
||||||
this_sem_190_id = 22890 # they get 190s and 290s
|
this_sem_190_id = 23594 # they get 190s and 290s
|
||||||
this_sem_192_id = 22894 # they get 192s
|
this_sem_192_id = 23603 # they get 192s
|
||||||
# this_sem_term = 289
|
# this_sem_term = 289
|
||||||
|
|
||||||
term = find_term( input("term? (ex: fa25) ") )
|
term = find_term( input("term? (ex: fa25) ") )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue