1

Temporary stubs

This commit is contained in:
Alex Yatskov 2015-08-23 15:43:07 +09:00
parent f0c8b6479b
commit 0d3af72b6b

View File

@ -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,