diff options
| author | Adam Soltys <[email protected]> | 2012-11-12 23:25:09 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2012-11-12 23:25:09 -0800 |
| commit | 54c28a395db853c601d3592c967f322c7f09e1d4 (patch) | |
| tree | 5e5ccd511daa0eabe82b5591298918c015d2eb14 /app.coffee | |
| parent | 5bba3395bc0bb84dcd24a7ade0c855a6beb6dbef (diff) | |
| download | coinos-server-54c28a395db853c601d3592c967f322c7f09e1d4.tar.gz coinos-server-54c28a395db853c601d3592c967f322c7f09e1d4.zip | |
Making progress on transactions report
Diffstat (limited to 'app.coffee')
| -rw-r--r-- | app.coffee | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -20,8 +20,8 @@ app.get('/', (req, res) -> res.render('index', js: (-> global.js), css: (-> global.css)) ) -app.get('/report', (req, res) -> - res.render('report', js: (-> global.js), css: (-> global.css)) +app.get('/:user/report', (req, res) -> + res.render('report', user: req.params.user, js: (-> global.js), css: (-> global.css)) ) app.get('/:user.json', (req, res) -> @@ -35,16 +35,24 @@ app.get('/:user.json', (req, res) -> app.get('/:user/transactions', (req, res) -> db = require("redis").createClient() user = req.params.user + r = 'transactions': [] db.lrange("#{user}:transactions", 0, -1, (err, transactions) -> - for i in transactions - db.hgetall("#{user}:transactions:#{i}", (err, t) -> - res.write(JSON.stringify(t)) + process = (err, t) -> + r.transactions.push t + + if i >= transactions.length + res.write(JSON.stringify(r)) res.end() - ) + else + db.hgetall("#{user}:transactions:#{transactions[i++]}", process) + + i = 0 + db.hgetall("#{user}:transactions:#{transactions[i++]}", process) ) ) + app.get('/ticker', (req, res) -> symbol = req.params.symbol symbol or= 'virtexCAD' |
