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

« back to all changes in this revision

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

  • Committer: William Grant
  • Date: 2009-01-20 04:08:16 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: grantw@unimelb.edu.au-20090120040816-wia8bj4yhw6ym5of
www/apps/tutorialservice: Replace the second-last reference ever to ivle.db
    (insert_problem_attempt) with a Storm version.
ivle.db.insert_problem_attempt: Remove. Unused.

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
    # Get the Exercise from the database
159
159
    exercise = ivle.database.Exercise.get_by_name(req.store, exercisesrc)
160
160
 
161
 
    conn = db.DB()
162
 
    try:
163
 
        conn.insert_problem_attempt(
164
 
            user = req.user,
165
 
            exercisename = exercisesrc,
166
 
            date = time.localtime(),
167
 
            complete = test_results['passed'],
168
 
            attempt = code)
169
 
    finally:
170
 
        conn.close()
 
161
    attempt = ivle.database.ExerciseAttempt(user=req.user,
 
162
                                            exercise=exercise,
 
163
                                            date=datetime.datetime.now(),
 
164
                                            complete=test_results['passed'],
 
165
                                            text=unicode(code)) # XXX
171
166
 
 
167
    req.store.add(attempt)
 
168
    req.store.commit()
172
169
    # Query the DB to get an updated score on whether or not this problem
173
170
    # has EVER been completed (may be different from "passed", if it has
174
171
    # been completed before), and the total number of attempts.