diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-05-12 23:52:53 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-05-12 23:52:53 -0400 |
commit | 6566d3d7cbc021e109ba534d2e67a8a9cc8ad988 (patch) | |
tree | 3f724e8fa80706c1e52e3e0ccac18560ba0eb5f9 | |
parent | 7f62c74fb253555e8072654521ee8af4668c8924 (diff) | |
download | GradeBook-6566d3d7cbc021e109ba534d2e67a8a9cc8ad988.tar.gz GradeBook-6566d3d7cbc021e109ba534d2e67a8a9cc8ad988.zip |
added DB detection heuristic
-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 |