diff --git a/localcache2.py b/localcache2.py index 8b558e7..2574997 100644 --- a/localcache2.py +++ b/localcache2.py @@ -551,7 +551,7 @@ def courses_to_sched(): # Populate schedule table and correlate to courses table -def refresh_semester_schedule_db(term="fa25"): +def refresh_semester_schedule_db(term="sp26"): # TODO: fix units when they are variable... change to float in between range. round to 0.5 unit. @@ -612,22 +612,25 @@ def refresh_semester_schedule_db(term="fa25"): full_sis_code = sis_code+'-'+c['crn'] if full_sis_code in sis_to_sched: - print(c['cred']) - q = [sis_to_sched[full_sis_code][0][0], c['crn'], c['code'], c['cred'], c['teacher'], c['start'], c['end'], c['type'], c['loc'], c['site'], pod, int(c['cap']), int(c['act']), sis_code] - vals_cache.append( q ) # [ str(x) for x in q ] ) - #print(f"{i}: {q}") - i += 1 - if i % 100 == 0: - if EXECUTE: - cur.executemany(query, vals_cache) - conn.commit() - vals_cache = [] - t = time.process_time() - delta = t - last_time - last_time = t - print(f"Loop {i} - committed to db in %0.3fs. " % delta, flush=True) + shell_id = sis_to_sched[full_sis_code][0][0] else: print(f"{full_sis_code} not in canvas courses.") + shell_id = 1 + #print(c['cred']) + q = [shell_id, c['crn'], c['code'], c['cred'], c['teacher'], c['start'], c['end'], c['type'], c['loc'], c['site'], pod, int(c['cap']), int(c['act']), sis_code] + print(q) + vals_cache.append( q ) # [ str(x) for x in q ] ) + #print(f"{i}: {q}") + i += 1 + if i % 100 == 0: + if EXECUTE: + cur.executemany(query, vals_cache) + conn.commit() + vals_cache = [] + t = time.process_time() + delta = t - last_time + last_time = t + print(f"Loop {i} - committed to db in %0.3fs. " % delta, flush=True) except Exception as e: print(e)