Permalink
Browse files

and made the view output return an avgs object, to match the way we h…

…andle guesses. now the shows view is concievably useful outside of the list func...
  • Loading branch information...
1 parent 3ad9de4 commit 7b573fb3d3b3305cae6f5d0bbd7e163556c2e79d @cdcarter committed Jul 30, 2011
Showing with 7 additions and 5 deletions.
  1. +4 −4 lists/shows.js
  2. +2 −0 templates/listline.html
  3. +1 −1 views/shows/map.js
View
@@ -14,10 +14,10 @@ function(head,req) {
var doc = row.value;
doc.venue = row.key;
doc.link = path.rewrite(doc.id)
- if (doc.perfd==0) {
- doc.perfd = "None";
- doc.avg = "None";
- doc.latest = "None";
+ if (doc.avgs.perfd==0) {
+ doc.avgs.perfd = "None";
+ doc.avgs.avg = "None";
+ doc.avgs.latest = "None";
}
send(mustache.to_html(ddoc.templates.listline,doc))
}
View
@@ -2,8 +2,10 @@
<td><a href={{link}}>{{id}}</a></td>
<td>{{name}}</td>
<td>{{venue}}</td>
+ {{#avgs}}
<td>{{latest}}</td>
<td>{{avg}}</td>
+ {{/avgs}}
{{#guess}}
<td>{{box}}</td>
<td>{{usher}}</td>
View
@@ -4,6 +4,6 @@ function(doc) {
avgs = calc.avg(doc)
guess = calc.guess(doc,avgs)
- emit(doc.venue,{"name":doc.name, "avg": avgs.avg, "latest": avgs.latest, "perfd": avgs.perfd, "id": doc._id,"guess":guess})
+ emit(doc.venue,{"name":doc.name, "avgs": avgs, "id": doc._id,"guess":guess})
}
}

0 comments on commit 7b573fb

Please sign in to comment.