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

« back to all changes in this revision

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

  • Committer: Matt Giuca
  • Date: 2009-01-19 17:28:59 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: matt.giuca@gmail.com-20090119172859-htjq3rfpp0fhtpc9
ivle.worksheet: Added calculate_score. This is a nice clean Storm port of
    ivle.db.calculate_worksheet_score.
tutorial: Replaced use of ivle.db.calculate_worksheet_score with
    ivle.worksheet.calculate_score.
    Guess What!! Removed this module's dependency on ivle.db! Hooray!
    (Note: tutorialservice still depends on it).
bin/ivle-marks: Updated this script to use ivle.worksheet_calculate_score.
    Note that this DOES NOT execute properly -- it seems it didn't even
    before my changes (tries to call db.get_users). Not my fault; I'm
    committing and going to bed!
ivle.db: Removed calculate_worksheet_score.
    As this removes the dependency on get_problem_status, removed that too!
    Almost all the worksheet stuff is gone now!

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
from ivle import util
43
43
import ivle.conf
44
 
import ivle.db
45
44
import ivle.database
46
45
import ivle.worksheet
47
46
 
248
247
                worksheet.assessable = worksheet_from_xml.assessable
249
248
                req.store.commit()
250
249
            if worksheet.assessable:
251
 
                # XXX Refactor ivle.db
252
 
                db = ivle.db.DB()
253
 
                try:
254
 
                    mand_done, mand_total, opt_done, opt_total = (
255
 
                        db.calculate_score_worksheet(req.user.login, subject,
256
 
                            worksheet.name))
257
 
                finally:
258
 
                    db.close()
259
 
                # XXX End ivle.db
 
250
                # Calculate the user's score for this worksheet
 
251
                mand_done, mand_total, opt_done, opt_total = (
 
252
                    ivle.worksheet.calculate_score(req.store, req.user,
 
253
                        worksheet))
260
254
                if opt_total > 0:
261
255
                    optional_message = " (excluding optional exercises)"
262
256
                else: