Temporary stubs
This commit is contained in:
parent
f0c8b6479b
commit
0d3af72b6b
14
scrape.go
14
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,
|
||||
|
Loading…
Reference in New Issue
Block a user