diff options
-rwxr-xr-x | importGrades2gradebook.tcl | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/importGrades2gradebook.tcl b/importGrades2gradebook.tcl index 044948a..80f9d95 100755 --- a/importGrades2gradebook.tcl +++ b/importGrades2gradebook.tcl @@ -143,6 +143,19 @@ proc getGradescopeUsernames { db } { return $username_list } +proc getWebassignUsernames { db } { + set username_list {} + set eval_str [concat SELECT UserName FROM export_table] + set err [catch { + $db eval $eval_str v { + lappend username_list $v(UserName) + } + } errStat ] + iferror $err $errStat + if { $err } { return false } + return $username_list +} + proc getBlackboardUserGrade { db uname col } { set eval_str [concat SELECT \"$col\" FROM export_table where Username=='$uname'] @@ -156,6 +169,11 @@ proc getGradescopeUserGrade { db uname col } { return $val } +proc getWebassignUserGrade { db uname col } { + set eval_str [concat SELECT \"$col\" FROM export_table where UserName=='$uname'] + set val [$db onecolumn $eval_str] + return $val +} proc isInList { col listCol} { foreach sCol $listCol { @@ -190,6 +208,7 @@ proc parseBlackboardColName { col } { set result [regsub -nocase {\s+$} $name "" name] switch $name { Homework { set name Homework ; set category HomeWork } + HW { set name Homework ; set category HomeWork } "Lab report" { set name Lab ; set category LabReport} "Lab Report" { set name Lab ; set category LabReport} "Midterm" { set name "MidTerm Exam" ; set category MidTerm } @@ -249,6 +268,7 @@ proc parseGradescopeColName { col } { set category LogBook; } switch $name { + HW { set name Homework ; set category HomeWork } Homework { set name Homework ; set category HomeWork } Lab { set name Lab ; set category LabReport} Labbook { set name Logbook ; set category LogBook} @@ -265,6 +285,54 @@ proc parseGradescopeColName { col } { return [list $shortCol $category $maxScore $type] } +proc parseWebassignColName { col } { + set shortCol $col + set category ColumnInfo + set maxScore 0 + set type Score + + global username_list + + set infoColumsMarkers {{ - Lateness \(H:M:S\)} { - Max Points} { - Submission Time} {Total Lateness \(H:M:S\)}} + if { [isInList $col $infoColumsMarkers] } { + return [list $shortCol $category $maxScore $type] + } + + set colWithMaxScore "$shortCol - Max Points" + set maxScore [getForeignDBUserGrade foreignDB MaxScore $col ] + + set number {} + set name $shortCol + set result [regexp -nocase {(\D+)(\d+)} $shortCol match name number] + set result [regexp -nocase {(\S+)\s+$} $name match name] + if { [regexp -nocase {Pre-lab} $name match dummy] } { + set category HomeWork; + } + if { [regexp -nocase {Report} $name match dummy] } { + set category LabReport; + } + if { [regexp -nocase {Labbook} $name match dummy] } { + set category LogBook; + } + switch $name { + HW { set name Homework ; set category HomeWork } + Homework { set name Homework ; set category HomeWork } + Lab { set name Lab ; set category LabReport} + Labbook { set name Logbook ; set category LogBook} + "Final Project Design" { set category FinalExam } + "Final Project Report" { set category FinalExam } + default { } + } + if { $number eq "" } { + set shortCol "$name" + } else { + set shortCol "$name $number" + } + puts [list $col "--->" $shortCol $category $maxScore $type] + return [list $shortCol $category $maxScore $type] +} + + proc dbRequest {script} { # verbose evaluation of dbRequest with dry run capability global DRYRUN @@ -331,6 +399,11 @@ proc addStudentsFromGradescopeDB { db } { iferror $err $errStat } +proc addStudentsFromWebassignDB { db } { + # blackboard does not provide the following info + # adding students from WebAssign is not implemented +} + proc blackboardUsername2local { uname } { #return "$uname@email.wm.edu" # since 2022 @@ -341,6 +414,9 @@ proc gradescopeUsername2local { uname } { return $uname } +proc webassignUsername2local { uname } { + return $uname +} proc updateGrade { col locUname grade } { if { ! [isThereUserNameInTheGradesTable $locUname] } { @@ -441,6 +517,7 @@ proc alias {alias target} { set allForeignCols [getColListFromAnyTable foreignDB export_table] set dbOrigin Blackboard; # default if { {SID} in $allForeignCols } { set dbOrigin Gradescope } +if { $dbFileToExport == "WebAssign.db" } { set dbOrigin WebAssign } puts [list Detected foreign DB origin: $dbOrigin] switch $dbOrigin { @@ -460,6 +537,14 @@ switch $dbOrigin { alias normilizeGrade normilizeGradescopeGrade alias parseColName parseGradescopeColName } + WebAssign { + alias foreignUsername2local webassignUsername2local + alias addStudentsFromForeignDB addStudentsFromWebassignDB + alias getForeignDBUsernames getWebassignUsernames + alias getForeignDBUserGrade getWebassignUserGrade + alias normilizeGrade normilizeGradescopeGrade + alias parseColName parseWebassignColName + } default { puts "Unknown DB origin, exiting" exit 1 |