From a464159a21cd88989d3ec8f6b6d9a8f1abd2bdd0 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Tue, 21 Feb 2023 06:00:10 +0000 Subject: [PATCH] remove extra crap --- cmd/signup/main.go | 6 +----- signup/signup.go | 27 ++------------------------- sql/create_signups_table.sql | 1 - 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/cmd/signup/main.go b/cmd/signup/main.go index 3341fe7..240aa1b 100644 --- a/cmd/signup/main.go +++ b/cmd/signup/main.go @@ -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() }() diff --git a/signup/signup.go b/signup/signup.go index 69bc7e1..0509d03 100644 --- a/signup/signup.go +++ b/signup/signup.go @@ -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() } diff --git a/sql/create_signups_table.sql b/sql/create_signups_table.sql index fe6bd88..12d304d 100644 --- a/sql/create_signups_table.sql +++ b/sql/create_signups_table.sql @@ -5,6 +5,5 @@ CREATE TABLE IF NOT EXISTS signups ( how TEXT, why TEXT, links TEXT, - extra TEXT, decision TEXT );