Permalink
Browse files

the shows view (which powers the root rewrite) now gives us the volun…

…teer predictions
  • Loading branch information...
1 parent 47fa43f commit 6e111ed2b9570c17f6486ccbf0e519c5101ac8f7 @cdcarter committed Jul 30, 2011
Showing with 16 additions and 3 deletions.
  1. +2 −2 lists/shows.js
  2. +12 −0 templates/listline.html
  3. +2 −1 views/shows/map.js
View
4 lists/shows.js
@@ -8,13 +8,13 @@ function(head,req) {
send("<!doctype html><html><head><title>HouseCounter Web</title></head><body><h1>Shows</h1>")
- send("<table><tr><th>ID</th><th>Name</th><th>Venue</th><th>Latest Size</th><th>Average Size</th></tr>")
+ send("<table><tr><th>ID</th><th>Name</th><th>Venue</th><th>Latest Size</th><th>Average Size</th><th>Box</th><th>Usher</th><th>Side</th></tr>")
while(row=getRow()) {
var doc = row.value;
doc.venue = row.key;
doc.link = path.rewrite(doc.id)
- send(mustache.to_html("<tr><td><a href={{link}}>{{id}}</a></td><td>{{name}}</td><td>{{venue}}</td><td>{{latest}}</td><td>{{avg}}</td></tr>",doc))
+ send(mustache.to_html(ddoc.templates.listline,doc))
}
send("</table></body></html>")
View
12 templates/listline.html
@@ -0,0 +1,12 @@
+<tr>
+ <td><a href={{link}}>{{id}}</a></td>
+ <td>{{name}}</td>
+ <td>{{venue}}</td>
+ <td>{{latest}}</td>
+ <td>{{avg}}</td>
+ {{#guess}}
+ <td>{{box}}</td>
+ <td>{{usher}}</td>
+ <td>{{side}}</td>
+ {{/guess}}
+</tr>
View
3 views/shows/map.js
@@ -2,13 +2,14 @@ function(doc) {
if (doc.type == "show") {
var calc = require("views/lib/showmath").init()
avgs = calc.avg(doc)
+ guess = calc.guess(doc,avgs)
if (avgs.perfd==0) {
avgs.perfd = "None";
avgs.avg = "None";
avgs.latest = "None";
}
- emit(doc.venue,{"name":doc.name, "avg": avgs.avg, "latest": avgs.latest, "perfd": avgs.perfd, "id": doc._id})
+ emit(doc.venue,{"name":doc.name, "avg": avgs.avg, "latest": avgs.latest, "perfd": avgs.perfd, "id": doc._id,"guess":guess})
}
}

0 comments on commit 6e111ed

Please sign in to comment.