Last-minute fixes to get demo up and sorta running.

This commit is contained in:
Elf M. Sternberg 2016-02-07 21:18:42 -08:00
parent d03fa41da3
commit ebf56ae7c1
3 changed files with 7 additions and 5 deletions

View File

@ -13,6 +13,8 @@ GRANT ALL PRIVILEGES ON DATABASE officehours TO officehours;
-- Enable case-insensitive matches on some text columns, good for email -- Enable case-insensitive matches on some text columns, good for email
CREATE EXTENSION citext; CREATE EXTENSION citext;
CREATE EXTENSION btree_gist;
CREATE EXTENSION plv8;
# #

View File

@ -120,8 +120,8 @@ IF EXISTS (SELECT appointments.id FROM appointments WHERE client_id IN (
SELECT staff_id FROM relationship WHERE client_id = q_client_id)) SELECT staff_id FROM relationship WHERE client_id = q_client_id))
AND (q_timerange && appointments.during)) THEN AND (q_timerange && appointments.during)) THEN
RAISE EXCEPTION 'That appointment slot is already taken.'; RAISE EXCEPTION 'That appointment slot is already taken.';
INSERT INTO appointments (client_id, during) SELECT q_client_id, q_timerange;
END IF; END IF;
INSERT INTO appointments (client_id, during) SELECT q_client_id, q_timerange;
END END
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;

View File

@ -60,10 +60,10 @@
(let [[conn (connect)] (let [[conn (connect)]
[curs (.cursor conn)] [curs (.cursor conn)]
[ops ["PERFORM add_appointment(3, '[2015-02-07 10:00, 2015-02-07 10:30)');" [ops ["SELECT add_appointment(3, '[2015-02-07 10:00, 2015-02-07 10:30)');"
"PERFORM add_appointment(4, '[2015-02-07 10:30, 2015-02-07 11:00)');" "SELECT add_appointment(4, '[2015-02-07 10:30, 2015-02-07 11:00)');"
"PERFORM add_appointment(5, '[2015-02-07 13:00, 2015-02-07 13:30)');" "SELECT add_appointment(5, '[2015-02-07 13:00, 2015-02-07 13:30)');"
"PERFORM add_appointment(6, '[2015-02-07 13:30, 2015-02-07 14:00)');"]]] "SELECT add_appointment(6, '[2015-02-07 13:30, 2015-02-07 14:00)');"]]]
(for [op ops] (for [op ops]
(print op) (print op)