This commit is contained in:
Peter Howell 2025-11-13 17:48:10 +00:00
parent 0e5a62472d
commit 19a628efab
1 changed files with 46 additions and 42 deletions

View File

@ -689,6 +689,7 @@ def xlist_ii(parasite_id,host_id,new_name,new_code):
xyz = 'y'
#xyz = input("Perform cross list? Enter y for yes, n for no: ")
if xyz != 'n':
try:
uu = url + '/api/v1/courses/%s/sections' % parasite_id
c_sect = fetch(uu)
#print(json.dumps(c_sect,indent=2))
@ -714,6 +715,8 @@ def xlist_ii(parasite_id,host_id,new_name,new_code):
r3 = requests.put(u3, headers=header, params=data)
print(r3.text)
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
@ -1702,19 +1705,20 @@ def overview_start_dates():
def course_by_depts_terms(section=0):
get_fresh = 1
TERM = 287
WI_TERM = 286
get_fresh = 0
TERM = 291
WI_TERM = 290
DOING_WINTER_MOVES = 1
SEM = "sp25"
make_changes = 1
do_all = 0
SEM = "sp26"
winter_start_day = 2
aviation_start_day = 9
make_changes = 0
do_all = 'a'
winter_start_day = 5
aviation_start_day = 7
nursing_start_day = 0
spring_start_day = 27
spring_start_day = 26
# get list of online course shells
if get_fresh:
@ -1743,18 +1747,18 @@ def course_by_depts_terms(section=0):
# try to find online shell matching this schedule entry
try:
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:
print(f"DIDN'T FIND CRN - {start} {d_start} - {S['code']} {S['crn']} {S['name']}" )
continue
print(f" - {start} {d_start} - id: {this_id} - {S['code']} {S['crn']} {S['name']}" )
if 1:
#if d_start.month < 5 or d_start.month > 7:
# print(f" Ignoring {d_start}, starting too far away...")
# continue
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
#if d_start.month == 1 and d_start.day == nursing_start_day:
@ -1762,11 +1766,11 @@ def course_by_depts_terms(section=0):
# continue
if d_start.month == 1 and d_start.day == spring_start_day:
print(" Ignoring, term start date" )
print(f" IGNORE {report_line}" )
continue
else:
print(" Adjust course start day?")
#print(f" Adjust course start day? {report_line}")
if make_changes:
if do_all != 'a':
@ -1778,17 +1782,17 @@ def course_by_depts_terms(section=0):
'course[restrict_enrollments_to_course_dates]':True }
u2 = f"https://gavilan.instructure.com:443/api/v1/courses/{this_id}"
r3 = requests.put(u2, headers=header, params=data)
print(" updated.. OK")
print(f"+ UPDATED {report_line}")
make_changes = 1
if DOING_WINTER_MOVES:
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}
u2 = "https://gavilan.instructure.com:443/api/v1/courses/%s" % crn_to_canvasid[S['crn']]
if make_changes:
r3 = requests.put(u2, headers=header, params=data)
print(" updated.. OK")
#print(" updated.. OK")
#print(r3.text)
@ -1804,8 +1808,8 @@ def xlist_cwe():
# cwe192 get put into another shell
this_sem_190_id = 22890 # they get 190s and 290s
this_sem_192_id = 22894 # they get 192s
this_sem_190_id = 23594 # they get 190s and 290s
this_sem_192_id = 23603 # they get 192s
# this_sem_term = 289
term = find_term( input("term? (ex: fa25) ") )