Commit 73e597787040ac71ae3842007ec3d7b30a672619
oops, actually count winds, also better structure
Dominic Tarr committed on 9/24/2018, 8:44:57 AMParent: e6ce43fadfd737b2a52d0225424c5eb186e6e6b3
Files changed
db.js | changed |
db.js | |||
---|---|---|---|
@@ -89,9 +89,10 @@ | |||
89 | 89 … | var fstate = state[forecast.name] = state[forecast.name] || {} | |
90 | 90 … | var wstate = fstate[forecast.month] = fstate[forecast.month] || {winds: {}, count: 0} | |
91 | 91 … | forecast.winds.forEach(function (w) { | |
92 | 92 … | var wind = w.direction+' '+w.strength | |
93 | - wstate.winds[wind] = (wstate[wind] || 0) + 1 | ||
93 … | + wstate.winds[w.direction] = wstate.winds[w.direction] || {} | ||
94 … | + wstate.winds[w.direction][w.strength] = (wstate.winds[w.direction][w.strength] || 0) + 1 | ||
94 | 95 … | wstate.count ++ | |
95 | 96 … | }) | |
96 | 97 … | ||
97 | 98 … | if(Date.now() > ts + 10000) { | |
@@ -131,4 +132,5 @@ | |||
131 | 132 … | console.log(JSON.stringify(data, null, 2)) | |
132 | 133 … | }) | |
133 | 134 … | ||
134 | 135 … | ||
136 … | + | ||
Built with git-ssb-web