diff --git a/jstrr.css b/jstrr.css index c6dac0c..e68a45c 100644 --- a/jstrr.css +++ b/jstrr.css @@ -218,4 +218,4 @@ border: none; background: #ffffffc9; padding: 10px 15px; -} \ No newline at end of file +} diff --git a/jtserv/jtserv.rb b/jtserv/jtserv.rb index 6be6fc0..66abec8 100755 --- a/jtserv/jtserv.rb +++ b/jtserv/jtserv.rb @@ -261,7 +261,7 @@ pass = nil # Go to next step beginner = nil # Beginner flag secret = (/secret/i =~ h["trrmode"].to_s) - time = h["finish"] - h["start"] + time = h["finish"].to_f - h["start"].to_f types = h["types"].to_i miss = h["miss"].to_i text = h["text"] @@ -533,7 +533,7 @@ end json["start"] = userinfo["start"] json["finish"] = Time.now.to_f -STDERR.printf("Start=%.2f, Finish=%.2f\n", json["start"], json["finish"]) +#STDERR.printf("Start=%.2f, Finish=%.2f\n", json["start"], json["finish"]) eval = db.evalStep(user, json) socksend.call(ws_conn, JSON.generate(eval)) userinfo.delete("typelist") diff --git a/jtserv/rmuser.sh b/jtserv/rmuser.sh new file mode 100755 index 0000000..fdef9c0 --- /dev/null +++ b/jtserv/rmuser.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +## Feeding CSV as follows: +## user +# C123456X + +DB=${1:-users.sq3} +CSV=${2:-rmusers.csv} +if [ ! -f $DB ]; then + echo "You need to create user-sqlite3 file first" >&2 + head $0 >&2; exit +fi +sqlite3 ${DB} <<-EOF + .mode csv + CREATE TEMPORARY TABLE rmuser(user); + .import $CSV rmuser + DELETE FROM rmuser WHERE user LIKE 'user'; -- rm CSV header + select * from rmuser; + select count(*) from rmuser; + PRAGMA foreign_keys=on; + SELECT count(user)||'users found' FROM users; + DELETE FROM users WHERE user IN (SELECT user FROM rmuser); + SELECT count(user)||'users remain' FROM users; +EOF diff --git a/rmuser.sh b/rmuser.sh new file mode 100644 index 0000000..fdef9c0 --- /dev/null +++ b/rmuser.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +## Feeding CSV as follows: +## user +# C123456X + +DB=${1:-users.sq3} +CSV=${2:-rmusers.csv} +if [ ! -f $DB ]; then + echo "You need to create user-sqlite3 file first" >&2 + head $0 >&2; exit +fi +sqlite3 ${DB} <<-EOF + .mode csv + CREATE TEMPORARY TABLE rmuser(user); + .import $CSV rmuser + DELETE FROM rmuser WHERE user LIKE 'user'; -- rm CSV header + select * from rmuser; + select count(*) from rmuser; + PRAGMA foreign_keys=on; + SELECT count(user)||'users found' FROM users; + DELETE FROM users WHERE user IN (SELECT user FROM rmuser); + SELECT count(user)||'users remain' FROM users; +EOF