From 0d3af72b6bb4a9ebdcfbf82a50539269719a9161 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 23 Aug 2015 15:43:07 +0900 Subject: [PATCH] Temporary stubs --- scrape.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scrape.go b/scrape.go index 7b57f5f..4560add 100644 --- a/scrape.go +++ b/scrape.go @@ -100,6 +100,10 @@ func processData(restaurants []restaurant, stationsPath string) error { return nil } +func buildFeatures(r restaurant) (delicious, accommodating, affordable, atmospheric float64) { + return r.features["food"], r.features["service"], r.features["value"], r.features["atmosphere"] +} + func dumpData(dbPath string, restaraunts []restaurant) error { db, err := sql.Open("sqlite3", dbPath) if err != nil { @@ -133,6 +137,8 @@ func dumpData(dbPath string, restaraunts []restaurant) error { } for _, r := range restaraunts { + delicious, accommodating, affordable, atmospheric := buildFeatures(r) + _, err = db.Exec(` INSERT INTO reviews( name, @@ -149,10 +155,10 @@ func dumpData(dbPath string, restaraunts []restaurant) error { ) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, r.name, r.url, - 0, - 0, - 0, - 0, + delicious, + accommodating, + affordable, + atmospheric, r.longitude, r.latitude, r.closestStnDist,