gavconnect link updated, work on slo insert
This commit is contained in:
parent
06ca6a9dc8
commit
41c493a78f
15
courses.py
15
courses.py
|
|
@ -1246,17 +1246,24 @@ def course_term_summary_2():
|
|||
## ##
|
||||
|
||||
def do_gav_connect():
|
||||
crn = "40061"
|
||||
term = 178
|
||||
sem = "202330"
|
||||
get_fresh = 0
|
||||
crns = [sem + "-" + x.strip() for x in open('cache/starfish.txt','r').readlines()]
|
||||
target = len(crns)
|
||||
print(crns)
|
||||
a = input()
|
||||
|
||||
c = getCoursesInTerm(term, get_fresh, 0)
|
||||
i = 0
|
||||
|
||||
for course in c:
|
||||
if course['sis_course_id'] == f"{sem}-{crn}":
|
||||
if course['sis_course_id'] in crns:
|
||||
print("Adding gav connect to", course['name'])
|
||||
print()
|
||||
add_gav_connect(course['id'])
|
||||
|
||||
i += 1
|
||||
print(f"Added {i} redirects out of {target}.")
|
||||
def add_gav_connect(course_id):
|
||||
params = { "name": "GavConnect",
|
||||
"privacy_level": "anonymous",
|
||||
|
|
@ -1265,7 +1272,7 @@ def add_gav_connect(course_id):
|
|||
"shared_secret": "N/A",
|
||||
"url": "https://www.edu-apps.org/redirect",
|
||||
"custom_fields[new_tab]": "1",
|
||||
"custom_fields[url]": "https://gavilan.starfishsolutions.com/starfish-ops/support/login.html?tenantId=9458",
|
||||
"custom_fields[url]": "https://gavilan.starfishsolutions.com/starfish-ops/dl/student/dashboard.html",
|
||||
"workflow_state": "anonymous",
|
||||
"course_navigation[enabled]": "true",
|
||||
"course_navigation[visibility]": "public",
|
||||
|
|
|
|||
24
outcomes.py
24
outcomes.py
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
|
||||
import requests, json, codecs, csv, re, sys
|
||||
import requests, json, codecs, csv, re, sys, os, shutil, time
|
||||
from collections import defaultdict
|
||||
|
||||
from pipelines import fetch, url, header
|
||||
|
|
@ -221,7 +221,7 @@ def connect_acct_oc_to_course(course_id,oc_group_id):
|
|||
o_id = str(o['outcome']['id'])
|
||||
|
||||
t = url + '/api/v1/courses/' + str(course_id) + '/outcome_groups/' + og_id + '/outcomes/' + o_id
|
||||
printt
|
||||
#printt
|
||||
r = requests.put(t, headers=header)
|
||||
print(r.text )
|
||||
|
||||
|
|
@ -385,7 +385,7 @@ def outcome_report1():
|
|||
results = [ {'id':1697,'course_code':'anth5 10407'},{'id':1825,'course_code':'anth1 10398'},{'id':2565,'course_code':'csis8 10705'}]
|
||||
for c in results:
|
||||
oc_t = url + '/api/v1/courses/' + str(c['id']) + '/outcome_results'
|
||||
while oc_t: oc_t = fetch_dict(oc_t) # TODO
|
||||
while oc_t: oc_t = fetch(oc_t) # TODO
|
||||
if len(results_dict['outcome_results']):
|
||||
print(c['id'], "\t", c['course_code'])
|
||||
output.write( "\t".join([str(c['id']), c['course_code'], "\n"]))
|
||||
|
|
@ -658,7 +658,7 @@ def course_slo_getter(q):
|
|||
else:
|
||||
print(" - Failed with image %i." % i)
|
||||
|
||||
|
||||
'''
|
||||
results = []
|
||||
|
||||
def threaded_getter():
|
||||
|
|
@ -679,7 +679,7 @@ def threaded_getter():
|
|||
for q in qqueue:
|
||||
q["total"] = len(qqueue)
|
||||
results.append( pool.submit(course_slo_getter, q) )
|
||||
|
||||
'''
|
||||
|
||||
|
||||
# Creating outcomes with scale
|
||||
|
|
@ -1272,11 +1272,11 @@ def parse_ilearn_course_names_ALLSEMESTERS():
|
|||
log = codecs.open('cache/log_ilearn_course_names_parsing.txt','w','utf-8')
|
||||
|
||||
for t in [25,26,60,61,62,63,64,65,168,171,172,173,174,175,176,177,178]:
|
||||
parse_ilearn_course_names_sub(str(t),1,log)
|
||||
parse_ilearn_course_names(str(t),1,log)
|
||||
|
||||
|
||||
|
||||
def parse_ilearn_course_names(term='178',fresh=1,log=0):
|
||||
def parse_ilearn_course_names(term='178',fresh=0,log=0):
|
||||
non_matches = []
|
||||
|
||||
courses = getCoursesInTerm(term,get_fresh=fresh)
|
||||
|
|
@ -1287,16 +1287,16 @@ def parse_ilearn_course_names(term='178',fresh=1,log=0):
|
|||
continue
|
||||
cq_code = find_cq_course_version(code)
|
||||
if cq_code: # in cq_codes:
|
||||
print(" cq course id: ", cq_code)
|
||||
line = f"{C['name']} is cq course id: {cq_code}"
|
||||
print(line)
|
||||
if log: log.write(line+"\n")
|
||||
else:
|
||||
print(" NO CQ MATCH")
|
||||
print(f"{C['name']} - NO CQ MATCH")
|
||||
non_matches.append( [code,crn] )
|
||||
|
||||
print("Non matches:")
|
||||
if log: log.write("\n\n------------\nTERM: " + str(term) + "\n")
|
||||
for n in non_matches:
|
||||
print(n)
|
||||
if log: log.write(str(n)+"\n")
|
||||
print("can't figure out shortname for ", len(non_matches), " courses...")
|
||||
|
||||
|
||||
|
|
@ -1314,6 +1314,8 @@ if __name__ == "__main__":
|
|||
8: ['get all outcome groups', all_og],
|
||||
9: ['demo get outcomes', demo_o_fetch],
|
||||
10: ['demo post outcomes to course', add_outcomes_course_code],
|
||||
|
||||
|
||||
11: ['match ilearn courses to cq courses', parse_ilearn_course_names],
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ import codecs, json
|
|||
from path_dict import PathDict
|
||||
|
||||
|
||||
NUM_THREADS = 8
|
||||
NUM_THREADS = 20
|
||||
get_fresh = 0
|
||||
sem_courses = getCoursesInTerm(176,get_fresh)
|
||||
sem_courses = getCoursesInTerm(178,get_fresh)
|
||||
|
||||
# shorter list for test?
|
||||
#sem_courses = sem_courses[:50]
|
||||
|
|
@ -52,26 +52,29 @@ def course_slo_getter(q):
|
|||
print(" -> " + url + oo['outcome']['url'])
|
||||
this_outcome = fetch( url + oo['outcome']['url'] )
|
||||
og['full_outcomes'][this_outcome['id']] = this_outcome
|
||||
og_for_course.insert(0,info)
|
||||
og_for_course.update(info)
|
||||
print(" - Thread %s DONE" % str(id))
|
||||
return og_for_course
|
||||
|
||||
raw_log = codecs.open('cache/outcome_raw_log.txt','w','utf-8')
|
||||
#raw_log.write( json.dumps(output,indent=2) )
|
||||
|
||||
output = []
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=NUM_THREADS) as pool:
|
||||
results = []
|
||||
futures = []
|
||||
for C in sem_courses:
|
||||
print("Adding ", C['name'], C['id'], " to queue")
|
||||
results.append( pool.submit(course_slo_getter, [C['name'], C['id']] ) )
|
||||
|
||||
print("-- Done")
|
||||
print("results array has %i items" % len(results))
|
||||
futures.append( pool.submit(course_slo_getter, [C['name'], C['id']] ) )
|
||||
for future in concurrent.futures.as_completed(futures):
|
||||
output.append(future.result())
|
||||
print(future.result())
|
||||
raw_log.write( json.dumps(future.result(),indent=2) + "\n" )
|
||||
#print("-- Done")
|
||||
#print("results array has %i items" % len(results))
|
||||
|
||||
for r in concurrent.futures.as_completed(results):
|
||||
output.append(r.result())
|
||||
#for r in concurrent.futures.as_completed(results):
|
||||
# output.append(r.result())
|
||||
|
||||
raw_log = codecs.open('cache/outcome_raw_log.txt','w','utf-8')
|
||||
raw_log.write( json.dumps(output,indent=2) )
|
||||
|
||||
|
||||
def ilearn_shell_slo_to_csv(shell_slos):
|
||||
|
|
|
|||
Loading…
Reference in New Issue