diff options
-rwxr-xr-x | GradeBook.tcl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl index c78875b..b1d7e82 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -403,6 +403,7 @@ proc AddColumn { permission_list user } { global script_name set columnname2add [::ncgi::value columnname2add {}] set column_category [::ncgi::value column_category {}] + set maxpointpossible [::ncgi::value maxpointpossible {}] if { $columnname2add != "" } { set eval_str [concat ALTER TABLE GradesTable ADD \"$columnname2add\" real] @@ -411,6 +412,19 @@ proc AddColumn { permission_list user } { htmlErrorMsg $errStat dbg "the following error happen: $errStat" 3 } + + set sql_str [concat UPDATE GradesTable SET \"$columnname2add\"=\'$column_category\' where UserName=\"_Col_Category_\"] + set err [catch {db eval $sql_str } errStat] + if { $err } { + htmlErrorMsg $errStat + dbg "the following error happen: $errStat" 3 + } + set sql_str [concat UPDATE GradesTable SET \"$columnname2add\"=\'$maxpointpossible\' where UserName=\"_Max_Points_\"] + set err [catch {db eval $sql_str } errStat] + if { $err } { + htmlErrorMsg $errStat + dbg "the following error happen: $errStat" 3 + } } else { htmlErrorMsg "empty column names are not permitted" |