Permalink
Browse files

Generate real problems, tweak style.

  • Loading branch information...
1 parent dd96870 commit 52a8a72351de4ed8d492bdca2ee243d41eafae14 @spraints committed Apr 19, 2012
Showing with 7 additions and 3 deletions.
  1. +2 −2 public/app.css
  2. +5 −1 worksheet.coffee
View
@@ -7,8 +7,8 @@ body {
border-bottom: solid 1px black;
font-size: 50px;
margin: 20px;
- margin-bottom: 50px;
- width: 100px;
+ margin-bottom: 70px;
+ width: 140px;
}
.problem > div {
text-align: right;
View
@@ -7,6 +7,10 @@ app.register '.coffee', require('coffeekup').adapters.express
app.use express.static(__dirname + '/public')
app.get '/', (req, res) -> res.render('index')
app.get '/worksheet', (req, res) ->
- res.render('worksheet', {problems: [{a:1,b:1}, {a:2, b:2}]})
+ count = req.query.count || 10
+ max = parseInt(req.query.max || 5)
+ rng = -> Math.floor(Math.random() * (max + 1))
+ problems = ({a:rng(), b:rng()} for x in [1..count])
+ res.render('worksheet', {problems: problems})
app.listen(process.env.PORT || 3000)

0 comments on commit 52a8a72

Please sign in to comment.