remove extra crap

pull/1/head
vilmibm 2023-02-21 06:00:10 +00:00
parent 86dc9cef2d
commit a464159a21
3 changed files with 3 additions and 31 deletions

View File

@ -269,7 +269,7 @@ func _main(l *log.Logger, db *signup.DB) error {
`), `),
"", "",
nil, nil,
func(s *scene) { su.Extra = string(s.Input.Bytes()) }), nil),
} }
sm := newSceneManager(msgScroll, scenes) sm := newSceneManager(msgScroll, scenes)
@ -320,10 +320,6 @@ func _main(l *log.Logger, db *signup.DB) error {
defer func() { defer func() {
l.Println("exiting") l.Println("exiting")
if sm.Current.Name == "done" {
sm.Current.OnAdvance(sm.Current)
db.UpdateSignup(su)
}
db.Close() db.Close()
}() }()

View File

@ -32,7 +32,6 @@ type TownSignup struct {
How string How string
Why string Why string
Links string Links string
Extra string
Notes []AdminNote Notes []AdminNote
Decision SignupDecision Decision SignupDecision
} }
@ -65,14 +64,14 @@ func NewDB() (*DB, error) {
func (d *DB) InsertSignup(su *TownSignup) error { func (d *DB) InsertSignup(su *TownSignup) error {
stmt, err := d.db.Prepare(` stmt, err := d.db.Prepare(`
INSERT INTO signups (created, email, how, why, links, extra) VALUES( INSERT INTO signups (created, email, how, why, links, extra) VALUES(
?, ?, ?, ?, ?, ? ?, ?, ?, ?, ?
) RETURNING id ) RETURNING id
`) `)
if err != nil { if err != nil {
return err 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 { if err != nil {
return err return err
} }
@ -89,28 +88,6 @@ func (d *DB) InsertSignup(su *TownSignup) error {
return nil 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 { func (d *DB) Close() error {
return d.db.Close() return d.db.Close()
} }

View File

@ -5,6 +5,5 @@ CREATE TABLE IF NOT EXISTS signups (
how TEXT, how TEXT,
why TEXT, why TEXT,
links TEXT, links TEXT,
extra TEXT,
decision TEXT decision TEXT
); );