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

« back to all changes in this revision

Viewing changes to ivle/db.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:
269
269
 
270
270
        return d['problemid']
271
271
 
272
 
    def insert_problem_attempt(self, user, exercisename, date, complete,
273
 
        attempt, dry=False):
274
 
        """Inserts the details of a problem attempt into the database.
275
 
        exercisename: Name of the exercise. (identifier field of problem
276
 
            table). If this exercise does not exist, also creates a new row in
277
 
            the problem table for this exercise name.
278
 
        user: The user submitting the attempt.
279
 
        date: struct_time, the date this attempt was made.
280
 
        complete: bool. Whether the test passed or not.
281
 
        attempt: Text of the attempt.
282
 
 
283
 
        Note: Even if dry, will still physically call get_problem_problemid,
284
 
        which may mutate the DB.
285
 
        """
286
 
        problemid = self.get_problem_problemid(exercisename)
287
 
 
288
 
        return self.insert({
289
 
                'problemid': problemid,
290
 
                'loginid': user.id,
291
 
                'date': date,
292
 
                'complete': complete,
293
 
                'attempt': attempt,
294
 
            }, 'problem_attempt',
295
 
            frozenset(['problemid','loginid','date','complete','attempt']),
296
 
            dry=dry)
297
 
 
298
272
    def write_problem_save(self, user, exercisename, date, text, dry=False):
299
273
        """Writes text to the problem_save table (for when the user saves an
300
274
        exercise). Creates a new row, or overwrites an existing one if the