1

Validation

This commit is contained in:
Alex Yatskov 2015-06-29 13:13:54 +09:00
parent cf586e853a
commit 34eb387223
2 changed files with 16 additions and 8 deletions

View File

@ -298,14 +298,15 @@
function updateMode() { function updateMode() {
if (_.has(_elements, 'mode')) { if (_.has(_elements, 'mode')) {
_elements.mode.attr({
text: _data.mode
});
} }
else { else {
_elements.mode = _canvas.text( _elements.mode = _canvas.text(
(_width - _bracketSize) / 2, (_width - _bracketSize) / 2,
_height - _modeSize / 2, _height - _modeSize / 2,
'x' _data.mode
).attr({ ).attr({
'dominant-baseline': 'middle', 'dominant-baseline': 'middle',
'text-anchor': 'middle' 'text-anchor': 'middle'

17
util.go
View File

@ -39,7 +39,7 @@ func fixFeatures(features featureMap) featureMap {
"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]
fixedFeatures[name] = value fixedFeatures[name] = value
} }
@ -48,13 +48,20 @@ func fixFeatures(features featureMap) featureMap {
} }
func fixModes(modes map[string]string) modeMap { func fixModes(modes map[string]string) modeMap {
result := make(modeMap) fixedModes := modeMap{
"nearby": ModeTypeProduct,
"accessible": ModeTypeProduct,
"delicious": ModeTypeProduct,
"accommodating": ModeTypeProduct,
"affordable": ModeTypeProduct,
"atmospheric": ModeTypeProduct}
for name, value := range modes { for name := range fixedModes {
result[name] = strToModeType(value) value, _ := modes[name]
fixedModes[name] = strToModeType(value)
} }
return result return fixedModes
} }
func innerProduct(features1 featureMap, features2 featureMap) float64 { func innerProduct(features1 featureMap, features2 featureMap) float64 {