forked from tildetown/town
remove extra crap
parent
86dc9cef2d
commit
a464159a21
|
@ -269,7 +269,7 @@ func _main(l *log.Logger, db *signup.DB) error {
|
|||
`),
|
||||
"",
|
||||
nil,
|
||||
func(s *scene) { su.Extra = string(s.Input.Bytes()) }),
|
||||
nil),
|
||||
}
|
||||
|
||||
sm := newSceneManager(msgScroll, scenes)
|
||||
|
@ -320,10 +320,6 @@ func _main(l *log.Logger, db *signup.DB) error {
|
|||
|
||||
defer func() {
|
||||
l.Println("exiting")
|
||||
if sm.Current.Name == "done" {
|
||||
sm.Current.OnAdvance(sm.Current)
|
||||
db.UpdateSignup(su)
|
||||
}
|
||||
db.Close()
|
||||
}()
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ type TownSignup struct {
|
|||
How string
|
||||
Why string
|
||||
Links string
|
||||
Extra string
|
||||
Notes []AdminNote
|
||||
Decision SignupDecision
|
||||
}
|
||||
|
@ -65,14 +64,14 @@ func NewDB() (*DB, error) {
|
|||
func (d *DB) InsertSignup(su *TownSignup) error {
|
||||
stmt, err := d.db.Prepare(`
|
||||
INSERT INTO signups (created, email, how, why, links, extra) VALUES(
|
||||
?, ?, ?, ?, ?, ?
|
||||
?, ?, ?, ?, ?
|
||||
) RETURNING id
|
||||
`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
result, err := stmt.Exec(su.Created.Unix(), su.Email, su.How, su.Why, su.Links, su.Extra)
|
||||
result, err := stmt.Exec(su.Created.Unix(), su.Email, su.How, su.Why, su.Links)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -89,28 +88,6 @@ func (d *DB) InsertSignup(su *TownSignup) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (d *DB) UpdateSignup(su *TownSignup) error {
|
||||
if su.ID < 0 {
|
||||
return nil
|
||||
}
|
||||
stmt, err := d.db.Prepare(`
|
||||
UPDATE signups (email, how, why, links, extra) VALUES(
|
||||
?, ?, ?, ?, ?
|
||||
)
|
||||
`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = stmt.Exec(su.Email, su.How, su.Why, su.Links, su.Extra)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer stmt.Close()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *DB) Close() error {
|
||||
return d.db.Close()
|
||||
}
|
||||
|
|
|
@ -5,6 +5,5 @@ CREATE TABLE IF NOT EXISTS signups (
|
|||
how TEXT,
|
||||
why TEXT,
|
||||
links TEXT,
|
||||
extra TEXT,
|
||||
decision TEXT
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue