diff options
-rwxr-xr-x | blackboard2gradebook.tcl | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/blackboard2gradebook.tcl b/blackboard2gradebook.tcl index 7a861bb..8454205 100755 --- a/blackboard2gradebook.tcl +++ b/blackboard2gradebook.tcl @@ -13,6 +13,8 @@ source ./GradeBook_lib.tcl set options { {w "Write to database, disabled by default"} + {v "Verbose"} + {d "Debug write DB operations"} } set usage " Usage: @@ -43,8 +45,8 @@ try { } ################# Config ############################################ -#set categories2export [list FinalExam HomeWork LabReport] -set categories2export [list FinalExam] +set categories2export [list FinalExam HomeWork LabReport] +#set categories2export [list FinalExam] set commonInfoCol {{First Name} {Last Name} {Student ID} {Last Access} Username Availability } set infoColumsMarkers {{ - Lateness \(H:M:S\)} { - Max Points} { - Submission Time} {Total Lateness \(H:M:S\)} {Current Weighted} {Total \[} } @@ -59,6 +61,9 @@ if { $DRYRUN} { puts "DRYRUN: DB will not be modified" } +set VERBOSE [expr {$params(v)}] +set DBDEBUG [expr {$params(d)}] + set classDB [lindex $argv 0] set blackboardDB [lindex $argv 1] @@ -75,6 +80,20 @@ proc iferror { err errStat {eval_str {""} }} { } } +proc dbg { msg } { + global VERBOSE + if { $VERBOSE } { + puts $msg + } +} + +proc dbdbg { msg } { + global DBDEBUG + if { $DBDEBUG } { + puts -nonewline $msg + } +} + proc getColListFromAnyTable {db table} { set all_column_names "" set eval_str [concat SELECT * FROM \'$table\' LIMIT 1] @@ -161,9 +180,9 @@ proc dbRequest {script} { append cmd $line\n if { [info complete $cmd] } { if { ![info exists DRYRUN] || $DRYRUN} { - #puts -nonewline "DRYRUN: $cmd" + dbdbg "DRYRUN: $cmd" } else { - puts -nonewline "Executing: $cmd" + dbdbg "EXECUTING: $cmd" uplevel 1 $cmd } set cmd "" @@ -202,7 +221,7 @@ proc updateGrade { col locUname grade } { if { [regexp -nocase -- {excuse} $oldGrade] } { # remote system do not handle excuses # so local system take precedence - #puts [list "not updating \"excused\" grade:" $locUname $col $oldGrade "-->" $grade] + dbg [list "not updating \"excused\" grade:" $locUname $col $oldGrade "-->" $grade] return } if { $oldGrade != $grade } { @@ -216,13 +235,13 @@ proc pickCols2import { cols2import skipCreationCol categories2export } { set reduced_list {} foreach col $cols2import { if { [isInList $col $skipCreationCol] } { - puts "skipping column $col" + dbg "skipping column $col" continue } set colInfo [trimColName $col] set category [lindex $colInfo 1] if { $category ni $categories2export } { - puts [list skipping $col in $category, permitted categories: $categories2export] + dbg [list skipping $col in $category, permitted categories: $categories2export] continue } lappend reduced_list $col |