aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-03-10 22:02:44 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-03-10 22:02:44 -0500
commitf3ab02f3f69a6200099a9e778f8dccd9798e0825 (patch)
tree063a1711da901de36d6a1a3c8885d893489e66b9
parent1eaf68766b884bedd65e1f3d64eca96c79c37c31 (diff)
parent05a3a06d047e613358c2818154a5e13de3661fac (diff)
downloadGradeBook-f3ab02f3f69a6200099a9e778f8dccd9798e0825.tar.gz
GradeBook-f3ab02f3f69a6200099a9e778f8dccd9798e0825.zip
Merge branch 'next' of qo.physics.wm.edu:evmik/GradeBook into next
-rwxr-xr-xconvertGradescopeDB.tcl95
-rwxr-xr-xcsv2rawSqliteDB.sh14
2 files changed, 109 insertions, 0 deletions
diff --git a/convertGradescopeDB.tcl b/convertGradescopeDB.tcl
new file mode 100755
index 0000000..29e8307
--- /dev/null
+++ b/convertGradescopeDB.tcl
@@ -0,0 +1,95 @@
+#!/bin/sh
+# (C) 2011 by Eugeniy Mikhailov, <evgmik@gmail.com>
+# vim:set ft=tcl: \
+exec tclsh "$0" "$@"
+
+set reviewersToSkip [list "Michael Kordosky" "Konstantinos Orginos"]
+
+package require sqlite3
+package require md5
+package require json::write
+
+source ./GradeBook_lib.tcl
+
+
+sqlite3 dbScoresAndNotes csvExport.db -readonly true
+sqlite3 db /run/user/1000/2021_physics.db
+
+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"
+ }
+ return true
+ }
+ return false
+}
+
+
+set rank [list Individual Ranking]
+set ReviewerName [list Application Review: Owner Name]
+set type [list Application Review Type]
+set fname [list First Name]
+set lname [list Last Name]
+set idnum [list SID]
+
+## create table id it does not exist
+CreateCourseInfoTable db
+CreateGradesTable db
+CreateAccessRightsTable db
+CreateGradesCategoryTable db
+
+
+## Pull out students related info
+set eval_str [concat SELECT * FROM 'applicants_raw']
+set err [catch {
+ dbScoresAndNotes eval $eval_str v {
+ #AddUserNonWeb $fname $lname $email student $id $sect
+ AddUserNonWeb $v($fname) $v($lname) $v(Email) student $v($idnum) 1
+ #addStudent db $v($idnum) $v(Contact)
+ }
+ } errStat ]
+iferror $err $errStat
+
+set hwPrefix "Homework"
+set labPrefix "Lab"
+## Fill the grades
+set eval_str [concat SELECT * FROM 'applicants_raw']
+set err [catch {
+ dbScoresAndNotes eval $eval_str v {
+ set all_column_names [getColListFromTable GradesTable]
+ foreach col $v(*) {
+ #puts $col
+ set result [regexp -nocase {Homework [0-9]+$} $col match]
+ if { $result } {
+ puts " -> $col"
+ if { $CategoryWeightedTolalName ni $all_column_names } {
+
+ AddColumnNonWeb $col HomeWork 20
+ }
+ #UpdateColumnWithValueInTableWhere GradesTable $col $v($col) IdNum $v($idnum)
+ }
+ }
+ }
+ } errStat ]
+iferror $err $errStat
+
+## Pull student decision
+#set eval_str [concat SELECT * FROM 'applicants_raw' where \`$type\` LIKE \'%GAS Physics Student Intent to Enroll%\']
+#set err [catch {
+ #dbScoresAndNotes eval $eval_str v {
+ #addStudent db $v($idnum) $v(Contact)
+ #if { $v(Decision) ne "" } {
+ #UpdateColumnWithValueInTableWhere db GradesTable StudentResponse $v(Decision) IdNum $v($idnum)
+ #}
+ #}
+ #} errStat ]
+#iferror $err $errStat
+
+
+
+
+
+
diff --git a/csv2rawSqliteDB.sh b/csv2rawSqliteDB.sh
new file mode 100755
index 0000000..b49414d
--- /dev/null
+++ b/csv2rawSqliteDB.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+inputCSV="$1"
+rm -f csvExport.db
+printf ".mode csv\n.import $inputCSV applicants_raw" | \
+sqlite3 csvExport.db
+
+#dbFile=2021_physics.db
+#tmpDir=/run/user/1000
+#tmpDB=$tmpDir/$dbFile
+#rm -f $tmpDB
+#./convert_raw2physics.tcl
+#mv $tmpDB .
+