From da0ed3a35650a540f16baa1670a0915c1218afad Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 26 Mar 2015 13:09:58 +0900 Subject: [PATCH] Display compatibility score on the client --- server.go | 1 + static/index.html | 6 ++++-- types.go | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index b56661f..b6ebaa2 100644 --- a/server.go +++ b/server.go @@ -83,6 +83,7 @@ func executeQuery(rw http.ResponseWriter, req *http.Request) { Name: value.name, Url: value.url, Score: value.score, + Compatibility: value.compatibility, DistanceToUser: value.distanceToUser, DistanceToStn: value.distanceToStn, ClosestStn: value.closestStn, diff --git a/static/index.html b/static/index.html index dac60a5..99d6834 100644 --- a/static/index.html +++ b/static/index.html @@ -100,8 +100,9 @@ Distance to user Closest station Distance to station - Access count + Compatibility Score + Access count {{#each records}} @@ -110,8 +111,9 @@ {{#prettyFloat 2}}{{distanceToUser}}{{/prettyFloat}} km {{closestStn}} {{distanceToStn}} m - {{accessCount}} + {{#prettyFloat 4}}{{compatibility}}{{/prettyFloat}} {{#prettyFloat 4}}{{score}}{{/prettyFloat}} + {{accessCount}} {{/each}} diff --git a/types.go b/types.go index 8c24696..619178c 100644 --- a/types.go +++ b/types.go @@ -59,6 +59,7 @@ type jsonProjection struct { type jsonRecord struct { AccessCount int `json:"accessCount"` ClosestStn string `json:"closestStn"` + Compatibility float64 `json:"compatibility"` DistanceToStn float64 `json:"distanceToStn"` DistanceToUser float64 `json:"distanceToUser"` Id int `json:"id"`