Permalink
Browse files

volunteer prediction all hooked up to the web info show

  • Loading branch information...
cdcarter committed Jul 27, 2011
1 parent 8dd9807 commit 21dcb000a8c6a4f879a7dc9abdfe602f803d5549
Showing with 14 additions and 21 deletions.
  1. +5 −21 shows/web-info.js
  2. +9 −0 templates/webinfo.html
View
@@ -1,28 +1,12 @@
function(doc,req) {
- var mustache = require("vendor/couchapp/lib/mustache");
- var path = require("vendor/couchapp/lib/path").init(req);
var ddoc = this;
- doc.avg = 0;
- doc.perfd = 0;
- for(var i=0,_len=doc.shows.length; i < _len; ++i) {
- if (typeof doc.shows[i].count !== "undefined" && doc.shows[i].count !== null){
- doc.avg = doc.avg + doc.shows[i].count;
- doc.perfd = doc.perfd + 1
- }
- doc.shows[i].idx = i
-
- doc.shows[i].time = ddoc.data.slots[doc.shows[i].slot]
- }
+ var mustache = require("vendor/couchapp/lib/mustache");
+ var path = require("vendor/couchapp/lib/path").init(req);
+ var calc = require("vendor/showmath").init(ddoc);
- if (doc.perfd == 0){
- doc.avg = "None"
- doc.latest = "None"
- doc.perfd = "None"
- } else {
- doc.avg = doc.avg/doc.perfd
- doc.latest = doc.shows[doc.perfd-1].count
- }
+ doc = calc.avg(doc);
+ doc.guess = calc.guess(doc);
doc.action = path.rewrite(doc._id)
doc.list = path.rewrite()
View
@@ -10,6 +10,15 @@ <h1>{{name}} @ {{venue}}</h1>
<tr><th>Average Size</th><td>{{avg}}</td></tr>
<tr><th>Latest Size</th><td>{{latest}}</td></tr>
</table>
+ <h2>Estimated Needs</h2>
+ <table>
+ {{#guess}}
+ <tr><th>Box Officers</th><td>{{box}}</td></tr>
+ <tr><th>Ushers</th><td>{{usher}}</td></tr>
+ <tr><th>Sidekicks</th><td>{{side}}</td></tr>
+ {{/guess}}
+ </table>
+ <h2>House Count for Slot</h2>
<form method=POST action="{{action}}" >
<table>
<thead>

0 comments on commit 21dcb00

Please sign in to comment.