1

Fixing stupid spelling mistake

This commit is contained in:
Alex Yatskov 2015-04-27 13:53:16 +09:00
parent 2d308c470b
commit 9d3091ebf7
3 changed files with 19 additions and 19 deletions

View File

@ -40,11 +40,11 @@ conn.query('USE hscd');
//
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) {
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.relativeUrl,
record.rating.food,

View File

@ -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
-- ------------------------------------------------------
-- 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_RESULTS=@@CHARACTER_SET_RESULTS */;
@ -103,7 +103,7 @@ CREATE TABLE `reviews` (
`name` varchar(100) NOT NULL,
`url` varchar(200) NOT NULL,
`delicious` float NOT NULL,
`accomodating` float NOT NULL,
`accommodating` float NOT NULL,
`affordable` float NOT NULL,
`atmospheric` float NOT NULL,
`latitude` float NOT NULL,
@ -135,4 +135,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!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
View File

@ -31,12 +31,12 @@ import (
func fixFeatures(features featureMap) featureMap {
fixedFeatures := featureMap{
"nearby": 0.0,
"accessible": 0.0,
"delicious": 0.0,
"accomodating": 0.0,
"affordable": 0.0,
"atmospheric": 0.0}
"nearby": 0.0,
"accessible": 0.0,
"delicious": 0.0,
"accommodating": 0.0,
"affordable": 0.0,
"atmospheric": 0.0}
for name, _ := range fixedFeatures {
value, _ := features[name]
@ -207,7 +207,7 @@ func computeRecordPopularity(entries records, context queryContext) {
}
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 {
log.Fatal(err)
}
@ -216,14 +216,14 @@ func getRecords(context queryContext) records {
var entries []record
for recordRows.Next() {
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
recordRows.Scan(
&name,
&url,
&delicious,
&accomodating,
&accommodating,
&affordable,
&atmospheric,
&latitude,
@ -243,10 +243,10 @@ func getRecords(context queryContext) records {
id: id}
entry.features = featureMap{
"delicious": delicious,
"accomodating": accomodating,
"affordable": affordable,
"atmospheric": atmospheric}
"delicious": delicious,
"accommodating": accommodating,
"affordable": affordable,
"atmospheric": atmospheric}
entries = append(entries, entry)
}