CSV Import is now working
This commit is contained in:
@@ -88,7 +88,12 @@ func PollHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
pollID := r.FormValue("poll_id")
|
||||
postalCode := r.FormValue("postal_code")
|
||||
|
||||
// Parse integer values
|
||||
question3LawnSigns, _ := strconv.Atoi(r.FormValue("question3_lawn_signs"))
|
||||
question4BannerSigns, _ := strconv.Atoi(r.FormValue("question4_banner_signs"))
|
||||
question5Thoughts := r.FormValue("question5_thoughts")
|
||||
question6donation := r.FormValue("question6_amount")
|
||||
|
||||
// Parse boolean values
|
||||
var question1VotedBefore *bool
|
||||
@@ -115,19 +120,16 @@ func PollHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// Parse integer values
|
||||
question3LawnSigns, _ := strconv.Atoi(r.FormValue("question3_lawn_signs"))
|
||||
question4BannerSigns, _ := strconv.Atoi(r.FormValue("question4_banner_signs"))
|
||||
|
||||
// Insert poll response
|
||||
_, err = models.DB.Exec(`
|
||||
INSERT INTO poll_response (
|
||||
poll_id, respondent_postal_code, question1_voted_before,
|
||||
question2_vote_again, question3_lawn_signs, question4_banner_signs,
|
||||
question5_thoughts
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
question5_thoughts, question6_donation_amount
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
`, pollID, postalCode, question1VotedBefore, question2VoteAgain,
|
||||
question3LawnSigns, question4BannerSigns, question5Thoughts)
|
||||
question3LawnSigns, question4BannerSigns, question5Thoughts, question6donation)
|
||||
|
||||
if err != nil {
|
||||
fmt.Print(err)
|
||||
|
||||
Reference in New Issue
Block a user