~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/apps/tutorial/__init__.py

  • Committer: mattgiuca
  • Date: 2008-04-17 05:02:32 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:735
tutorial: Added (very ad-hoc code) marks calculation at the end of
    present_subject. The student's mark out of 5 is displayed.
(Matt Giuca)

Show diffs side-by-side

added added

removed removed

Lines of Context:
264
264
                complete_class = "incomplete"
265
265
            problems_pct = (100 * problems_done) / problems_total       # int
266
266
            req.write('<ul><li class="%s">Total exercises completed: %d/%d '
267
 
                        '(%d%%)</li></ul>'
 
267
                        '(%d%%)</li></ul>\n'
268
268
                % (complete_class, problems_done, problems_total,
269
269
                    problems_pct))
 
270
            # XXX Marks calculation (should be abstracted out of here!)
 
271
            # percent / 16, rounded down, with a maximum mark of 5
 
272
            max_mark = 5
 
273
            mark = min(problems_pct / 16, max_mark)
 
274
            req.write('<p style="font-weight: bold">Worksheet mark: %d/%d'
 
275
                        '</p>\n' % (mark, max_mark))
270
276
        req.write("</div>\n")   # tutorialbody
271
277
    finally:
272
278
        db.close()