diff options
Diffstat (limited to 'blackboard2gradebook.tcl')
-rwxr-xr-x | blackboard2gradebook.tcl | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/blackboard2gradebook.tcl b/blackboard2gradebook.tcl index a616a0f..16da2d4 100755 --- a/blackboard2gradebook.tcl +++ b/blackboard2gradebook.tcl @@ -294,12 +294,26 @@ proc alias {alias target} { ######################### START of the execution ######################### -alias foreignUsername2local blackboardUsername2local -alias addStudentsFromForeignDB addStudentsFromBlackboardDB -alias getForeignDBUsernames getBlackboardUsernames -alias getForeignDBUserGrade getBlackboardUserGrade -alias normilizeGrade normilizeBlackboardGrade -alias parseColName parseBlackboardColName +# using heuristic to detect foreign DB origin +set allForeignCols [getColListFromAnyTable foreignDB export_table] +set dbOrigin Blackboard; # default +if { {SID} in $allForeignCols } { set dbOrigin Gradescope } +puts [list Detected foreign DB origin: $dbOrigin] + +switch $dbOrigin { + Blackboard { + alias foreignUsername2local blackboardUsername2local + alias addStudentsFromForeignDB addStudentsFromBlackboardDB + alias getForeignDBUsernames getBlackboardUsernames + alias getForeignDBUserGrade getBlackboardUserGrade + alias normilizeGrade normilizeBlackboardGrade + alias parseColName parseBlackboardColName + } + default { + puts "Unknown DB origin, exiting" + exit 1 + } +} addStudentsFromForeignDB foreignDB |