Fixing stupid spelling mistake
This commit is contained in:
parent
2d308c470b
commit
9d3091ebf7
@ -40,11 +40,11 @@ conn.query('USE hscd');
|
|||||||
//
|
//
|
||||||
|
|
||||||
conn.query('DROP TABLE IF EXISTS reviews');
|
conn.query('DROP TABLE IF EXISTS reviews');
|
||||||
conn.query('CREATE TABLE reviews(name VARCHAR(100) NOT NULL, url VARCHAR(200) NOT NULL, delicious FLOAT NOT NULL, accomodating FLOAT NOT NULL, affordable FLOAT NOT NULL, atmospheric FLOAT NOT NULL, latitude FLOAT NOT NULL, longitude FLOAT NOT NULL, distanceToStn FLOAT NOT NULL, closestStn VARCHAR(100) NOT NULL, accessCount INT NOT NULL, id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) DEFAULT CHARACTER SET utf8');
|
conn.query('CREATE TABLE reviews(name VARCHAR(100) NOT NULL, url VARCHAR(200) NOT NULL, delicious FLOAT NOT NULL, accommodating FLOAT NOT NULL, affordable FLOAT NOT NULL, atmospheric FLOAT NOT NULL, latitude FLOAT NOT NULL, longitude FLOAT NOT NULL, distanceToStn FLOAT NOT NULL, closestStn VARCHAR(100) NOT NULL, accessCount INT NOT NULL, id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) DEFAULT CHARACTER SET utf8');
|
||||||
|
|
||||||
for (var i = 0, count = data.length; i < count; ++i) {
|
for (var i = 0, count = data.length; i < count; ++i) {
|
||||||
var record = data[i];
|
var record = data[i];
|
||||||
conn.query('INSERT INTO reviews(name, url, delicious, accomodating, affordable, atmospheric, latitude, longitude, distanceToStn, closestStn, accessCount) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [
|
conn.query('INSERT INTO reviews(name, url, delicious, accommodating, affordable, atmospheric, latitude, longitude, distanceToStn, closestStn, accessCount) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [
|
||||||
record.name,
|
record.name,
|
||||||
record.relativeUrl,
|
record.relativeUrl,
|
||||||
record.rating.food,
|
record.rating.food,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
-- MySQL dump 10.13 Distrib 5.5.41, for debian-linux-gnu (x86_64)
|
-- MySQL dump 10.13 Distrib 5.5.43, for debian-linux-gnu (x86_64)
|
||||||
--
|
--
|
||||||
-- Host: localhost Database: hscd
|
-- Host: localhost Database: hscd
|
||||||
-- ------------------------------------------------------
|
-- ------------------------------------------------------
|
||||||
-- Server version 5.5.41-0ubuntu0.14.04.1
|
-- Server version 5.5.43-0ubuntu0.14.04.1
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
@ -103,7 +103,7 @@ CREATE TABLE `reviews` (
|
|||||||
`name` varchar(100) NOT NULL,
|
`name` varchar(100) NOT NULL,
|
||||||
`url` varchar(200) NOT NULL,
|
`url` varchar(200) NOT NULL,
|
||||||
`delicious` float NOT NULL,
|
`delicious` float NOT NULL,
|
||||||
`accomodating` float NOT NULL,
|
`accommodating` float NOT NULL,
|
||||||
`affordable` float NOT NULL,
|
`affordable` float NOT NULL,
|
||||||
`atmospheric` float NOT NULL,
|
`atmospheric` float NOT NULL,
|
||||||
`latitude` float NOT NULL,
|
`latitude` float NOT NULL,
|
||||||
@ -135,4 +135,4 @@ UNLOCK TABLES;
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2015-04-18 13:51:01
|
-- Dump completed on 2015-04-27 13:53:08
|
||||||
|
26
util.go
26
util.go
@ -31,12 +31,12 @@ import (
|
|||||||
|
|
||||||
func fixFeatures(features featureMap) featureMap {
|
func fixFeatures(features featureMap) featureMap {
|
||||||
fixedFeatures := featureMap{
|
fixedFeatures := featureMap{
|
||||||
"nearby": 0.0,
|
"nearby": 0.0,
|
||||||
"accessible": 0.0,
|
"accessible": 0.0,
|
||||||
"delicious": 0.0,
|
"delicious": 0.0,
|
||||||
"accomodating": 0.0,
|
"accommodating": 0.0,
|
||||||
"affordable": 0.0,
|
"affordable": 0.0,
|
||||||
"atmospheric": 0.0}
|
"atmospheric": 0.0}
|
||||||
|
|
||||||
for name, _ := range fixedFeatures {
|
for name, _ := range fixedFeatures {
|
||||||
value, _ := features[name]
|
value, _ := features[name]
|
||||||
@ -207,7 +207,7 @@ func computeRecordPopularity(entries records, context queryContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getRecords(context queryContext) records {
|
func getRecords(context queryContext) records {
|
||||||
recordRows, err := db.Query("SELECT name, url, delicious, accomodating, affordable, atmospheric, latitude, longitude, distanceToStn, closestStn, accessCount, id FROM reviews")
|
recordRows, err := db.Query("SELECT name, url, delicious, accommodating, affordable, atmospheric, latitude, longitude, distanceToStn, closestStn, accessCount, id FROM reviews")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -216,14 +216,14 @@ func getRecords(context queryContext) records {
|
|||||||
var entries []record
|
var entries []record
|
||||||
for recordRows.Next() {
|
for recordRows.Next() {
|
||||||
var name, url, closestStn string
|
var name, url, closestStn string
|
||||||
var delicious, accomodating, affordable, atmospheric, latitude, longitude, distanceToStn float64
|
var delicious, accommodating, affordable, atmospheric, latitude, longitude, distanceToStn float64
|
||||||
var accessCount, id int
|
var accessCount, id int
|
||||||
|
|
||||||
recordRows.Scan(
|
recordRows.Scan(
|
||||||
&name,
|
&name,
|
||||||
&url,
|
&url,
|
||||||
&delicious,
|
&delicious,
|
||||||
&accomodating,
|
&accommodating,
|
||||||
&affordable,
|
&affordable,
|
||||||
&atmospheric,
|
&atmospheric,
|
||||||
&latitude,
|
&latitude,
|
||||||
@ -243,10 +243,10 @@ func getRecords(context queryContext) records {
|
|||||||
id: id}
|
id: id}
|
||||||
|
|
||||||
entry.features = featureMap{
|
entry.features = featureMap{
|
||||||
"delicious": delicious,
|
"delicious": delicious,
|
||||||
"accomodating": accomodating,
|
"accommodating": accommodating,
|
||||||
"affordable": affordable,
|
"affordable": affordable,
|
||||||
"atmospheric": atmospheric}
|
"atmospheric": atmospheric}
|
||||||
|
|
||||||
entries = append(entries, entry)
|
entries = append(entries, entry)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user