A few updates.
This commit is contained in:
parent
dd91a3cb85
commit
1ab5bb05fd
4
main.hy
4
main.hy
|
@ -2,7 +2,9 @@
|
|||
|
||||
(import [flask [Flask]])
|
||||
(def app (Flask __name__))
|
||||
(def hello ((.route app "/") (fn [] "Hello World")))
|
||||
|
||||
(with-decorator (.route app "/") (defn hello [] "Hello World"))
|
||||
|
||||
(if (= __name__ "__main__")
|
||||
(.run app))
|
||||
|
||||
|
|
1
main.py
1
main.py
|
@ -1,4 +1,3 @@
|
|||
# from http://flask.pocoo.org/ tutorial
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
|
13
notes/bs.md
13
notes/bs.md
|
@ -15,6 +15,14 @@ Note: "BS" stands for BrainStorming.
|
|||
slot is booked, other clients should not be able to book that slot
|
||||
with the same coach.
|
||||
|
||||
## Alternatives
|
||||
|
||||
Google Calendar offers an "office hours" appointment mechanism. It
|
||||
doesn't quite do what the problem requires; it's only available to
|
||||
other members of the same school or corporate group account.
|
||||
|
||||
|
||||
|
||||
## Solution requirements:
|
||||
|
||||
* Data Store
|
||||
|
@ -175,6 +183,11 @@ TODO Postgres range example
|
|||
TODO Deliver home page
|
||||
TODO Deliver retreivals
|
||||
|
||||
---
|
||||
|
||||
Quick thoughts:
|
||||
|
||||
Craft views or
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Re-learning how to install Postgres (*Sigh)
|
||||
# Re-learning how to install Postgres (*Sigh)
|
||||
## WITH Postgres 9.4
|
||||
|
||||
CREATE DATABASE officehours;
|
||||
CREATE USER officehours;
|
||||
|
@ -16,17 +17,15 @@ CREATE EXTENSION citext;
|
|||
CREATE EXTENSION btree_gist;
|
||||
CREATE EXTENSION plv8;
|
||||
|
||||
#
|
||||
|
||||
What can I do?
|
||||
|
||||
# What can I do?
|
||||
|
||||
1) Add users and make them clients.
|
||||
2) Add users and make them staff.
|
||||
3) Allocate a block of time as "office hours"
|
||||
4) Allocate a block of time as an "appointment."
|
||||
|
||||
NEXT: Psycopg2
|
||||
## Progress:
|
||||
|
||||
** Progress: Everything works in psycopg2 EXCEPT add_appointment, which
|
||||
is very distressing. Really, _really_ don't want to take that
|
||||
functionality and put it into the middle tier. It's rock-solid business
|
||||
logic; it belongs in the database as a constraint.
|
||||
Everything works in psycopg2.
|
||||
|
|
21
play.hy
21
play.hy
|
@ -7,7 +7,6 @@
|
|||
(defn connect []
|
||||
(psycopg2.connect "host='localhost' dbname='officehours' user='officehours' password='eatabug'"))
|
||||
|
||||
|
||||
(def users [
|
||||
(, "Alice" "alice@example.com")
|
||||
(, "Bob" "bob@example.com")
|
||||
|
@ -58,16 +57,22 @@
|
|||
(.execute curs "INSERT INTO officehours (staff_id, during) VALUES (2, '[2015-02-07 12:00, 2015-02-07 15:00)');")
|
||||
(.commit conn))
|
||||
|
||||
|
||||
|
||||
; [ops ["SELECT add_appointment(3, '[2015-02-07 10:00, 2015-02-07 10:30)');"
|
||||
; "SELECT add_appointment(4, '[2015-02-07 10:30, 2015-02-07 11:00)');"
|
||||
; "SELECT add_appointment(5, '[2015-02-07 13:00, 2015-02-07 13:30)');"
|
||||
; "SELECT add_appointment(6, '[2015-02-07 13:30, 2015-02-07 14:00)');"]]]
|
||||
|
||||
|
||||
(let [[conn (connect)]
|
||||
[curs (.cursor conn)]
|
||||
[ops ["SELECT add_appointment(3, '[2015-02-07 10:00, 2015-02-07 10:30)');"
|
||||
"SELECT add_appointment(4, '[2015-02-07 10:30, 2015-02-07 11:00)');"
|
||||
"SELECT add_appointment(5, '[2015-02-07 13:00, 2015-02-07 13:30)');"
|
||||
"SELECT add_appointment(6, '[2015-02-07 13:30, 2015-02-07 14:00)');"]]]
|
||||
|
||||
[ops [(, 3 "[2015-02-07 10:00, 2015-02-07 10:30)")
|
||||
(, 4 "[2015-02-07 10:30, 2015-02-07 11:00)")
|
||||
(, 5 "[2015-02-07 13:00, 2015-02-07 13:30)")
|
||||
(, 6 "[2015-02-07 13:30, 2015-02-07 14:00)")]]]
|
||||
(for [op ops]
|
||||
(print op)
|
||||
(.execute curs op)
|
||||
(.callproc curs "add_appointment" op)
|
||||
(.commit conn)))
|
||||
|
||||
(let [[conn (connect)]
|
||||
|
|
Loading…
Reference in New Issue