diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-01-10 01:32:10 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-01-10 01:32:10 -0500 |
commit | 4a53250d61e85350c0bf63dd8c69c3c24ce7dedd (patch) | |
tree | 4e33f01830222b0eed6f19b339edff115e95314b /GradeBook.tcl | |
parent | b63da517866b6b78fadd725cde93692630fb13a4 (diff) | |
download | GradeBook-4a53250d61e85350c0bf63dd8c69c3c24ce7dedd.tar.gz GradeBook-4a53250d61e85350c0bf63dd8c69c3c24ce7dedd.zip |
max points and column category updated in table
Ignore-this: 57988a3c3b07164d172231a9deab8c1b
darcs-hash:20110110063210-067c0-c3a800bb6346e5f85eeca8c822603c403dff53b0.gz
Diffstat (limited to 'GradeBook.tcl')
-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" |