diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-05-13 11:05:59 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-05-13 11:05:59 -0400 |
commit | ec6da5bbc09c8fc8a16e5e07eb14ca6431609768 (patch) | |
tree | 8f21ce3c85e81def01746704514dca428f97df22 | |
parent | 0e87b824f5eea8fb4b95e97ae3daaae7acc1fa6b (diff) | |
download | GradeBook-ec6da5bbc09c8fc8a16e5e07eb14ca6431609768.tar.gz GradeBook-ec6da5bbc09c8fc8a16e5e07eb14ca6431609768.zip |
remove outdated file
-rwxr-xr-x | gradescope2gradebook.tcl | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/gradescope2gradebook.tcl b/gradescope2gradebook.tcl deleted file mode 100755 index 457cedd..0000000 --- a/gradescope2gradebook.tcl +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# (C) 2011 by Eugeniy Mikhailov, <evgmik@gmail.com> -# vim:set ft=tcl: \ -exec tclsh "$0" "$@" - -package require Tcl 8.5 -package require json::write -package require sqlite3 -package require md5 -source ./GradeBook_lib.tcl - -if { $argc < 2 } { - puts {Usage:} - puts " $argv0 gradebook.sqlitedb gradescope.sqlitedb" - puts {} - puts { expect both files to be sqilte tables:} - puts { gradescope should have a single table 'export_table':} - puts {Example:} - puts [concat " $argv0" { 2020_Fall_Phys251 gradescope.db}] - exit -} - -set classDB [lindex $argv 0] -set gradescopeDB [lindex $argv 1] - -sqlite3 db $classDB -sqlite3 gdb $gradescopeDB - -proc iferror { err errStat {eval_str {""} }} { - #return; # comment out when debugging - if { $err } { - puts "Error: $errStat" - if { $eval_str ne "" } { - puts "For query: $eval_str" - } - } -} - -proc getColListFromAnyTable {db table} { - set all_column_names "" - set eval_str [concat SELECT * FROM \'$table\' LIMIT 1] - set err [catch { - $db eval $eval_str v { - set all_column_names $v(*) - } - } errStat ] - iferror $err $errStat - if { $err } { return false } - return $all_column_names -} - -proc getGradescopeUsernames { db } { - set username_list {} - set eval_str [concat SELECT Email FROM export_table] - set err [catch { - $db eval $eval_str v { - lappend username_list $v(Email) - } - } errStat ] - iferror $err $errStat - if { $err } { return false } - return $username_list -} - -proc getGradescopeUserGrade { db uname col } { - set username_list {} - set eval_str [concat SELECT \"$col\" FROM export_table where Email=='$uname'] - set val [$db onecolumn $eval_str] - return $val -} - -proc isInList { col listCol} { - foreach sCol $listCol { - set result [regexp $sCol $col match] - if { $result } { - return true - } - } - return false - -} - -proc trimColName { col } { - set result [regexp -nocase {(.*) due week.*} $col match submatch] - if { $result} { - #puts $col - #puts $match - #puts $submatch - return $submatch - } - return $col -} - - -set commonInfoCol {{First Name} {Last Name} {SID} {Email}} -set infoColumsMarkers {{ - Lateness \(H:M:S\)} { - Max Points} { - Submission Time} {Total Lateness \(H:M:S\)}} - -set skipCreationCol [concat $commonInfoCol $infoColumsMarkers] - -## adding students if they do not exist -set fname [list First Name] -set lname [list Last Name] -set idnum [list SID] -set eval_str [concat SELECT * FROM 'export_table'] -set err [catch { - gdb eval $eval_str v { - AddUserNonWeb $v($fname) $v($lname) $v(Email) student $v($idnum) 1 - } - } errStat ] -iferror $err $errStat - - -# add columns with reports to gradebook db -foreach col [getColListFromAnyTable gdb export_table] { - if { [isInList $col $skipCreationCol] } { - continue - } - #puts "$col" - set shortCol [trimColName $col] - #puts "$col => $shortCol" - - if { ![doesColumnExists $shortCol GradesTable] } { - puts "Adding: ${shortCol}" - set result [regexp -nocase "pre-lab" $shortCol match] - if { $result} { - AddColumnNonWeb $shortCol PreLab 10 - continue - } - set result [regexp -nocase "homework" $shortCol match] - if { $result} { - AddColumnNonWeb $shortCol HomeWork 20 - continue - } - set result [regexp -nocase "lab" $shortCol match] - if { $result} { - AddColumnNonWeb $shortCol LabReport 50 - continue - } - # everything else is Note - AddColumnNonWeb $shortCol Note 0 - } else { - #puts "$col: exists" - } -} - -# now for every user add their grades -set username_list [getGradescopeUsernames gdb] -foreach uname $username_list { - foreach col [getColListFromAnyTable gdb export_table] { - if { [isInList $col $skipCreationCol] } { - continue - } - set shortCol [trimColName $col] - set grade [getGradescopeUserGrade gdb $uname $col ] - if { "" ne $grade } { - puts "setting $grade for $uname in $col" - UpdateColValue4UserNameNonWeb $shortCol $uname $grade - } - } -} - - - - |