1

Display compatibility score on the client

This commit is contained in:
Alex Yatskov 2015-03-26 13:09:58 +09:00
parent 474d02ebcb
commit da0ed3a356
3 changed files with 6 additions and 2 deletions

View File

@ -83,6 +83,7 @@ func executeQuery(rw http.ResponseWriter, req *http.Request) {
Name: value.name, Name: value.name,
Url: value.url, Url: value.url,
Score: value.score, Score: value.score,
Compatibility: value.compatibility,
DistanceToUser: value.distanceToUser, DistanceToUser: value.distanceToUser,
DistanceToStn: value.distanceToStn, DistanceToStn: value.distanceToStn,
ClosestStn: value.closestStn, ClosestStn: value.closestStn,

View File

@ -100,8 +100,9 @@
<th>Distance to user</th> <th>Distance to user</th>
<th>Closest station</th> <th>Closest station</th>
<th>Distance to station</th> <th>Distance to station</th>
<th>Access count</th> <th>Compatibility</th>
<th>Score</th> <th>Score</th>
<th>Access count</th>
</tr> </tr>
</thead> </thead>
{{#each records}} {{#each records}}
@ -110,8 +111,9 @@
<td>{{#prettyFloat 2}}{{distanceToUser}}{{/prettyFloat}} km</td> <td>{{#prettyFloat 2}}{{distanceToUser}}{{/prettyFloat}} km</td>
<td>{{closestStn}}</td> <td>{{closestStn}}</td>
<td>{{distanceToStn}} m</td> <td>{{distanceToStn}} m</td>
<td>{{accessCount}}</td> <td>{{#prettyFloat 4}}{{compatibility}}{{/prettyFloat}}</td>
<td>{{#prettyFloat 4}}{{score}}{{/prettyFloat}}</td> <td>{{#prettyFloat 4}}{{score}}{{/prettyFloat}}</td>
<td>{{accessCount}}</td>
</tr> </tr>
{{/each}} {{/each}}
</table> </table>

View File

@ -59,6 +59,7 @@ type jsonProjection struct {
type jsonRecord struct { type jsonRecord struct {
AccessCount int `json:"accessCount"` AccessCount int `json:"accessCount"`
ClosestStn string `json:"closestStn"` ClosestStn string `json:"closestStn"`
Compatibility float64 `json:"compatibility"`
DistanceToStn float64 `json:"distanceToStn"` DistanceToStn float64 `json:"distanceToStn"`
DistanceToUser float64 `json:"distanceToUser"` DistanceToUser float64 `json:"distanceToUser"`
Id int `json:"id"` Id int `json:"id"`