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

« back to all changes in this revision

Viewing changes to ivle/database.py

Modified worksheets to properly link attempts to worksheets and
exercises, not just exercises

Show diffs side-by-side

added added

removed removed

Lines of Context:
421
421
    def __repr__(self):
422
422
        return "<%s %s>" % (type(self).__name__, self.name)
423
423
 
424
 
#    @classmethod
425
 
#    def get_by_name(cls, store, name):
426
 
#        """
427
 
#        Get the Exercise from the db associated with a given store and name.
428
 
#        If the exercise is not in the database, creates it and inserts it
429
 
#        automatically.
430
 
#        """
431
 
#        ex = store.find(cls, cls.name == unicode(name)).one()
432
 
#        if ex is not None:
433
 
#            return ex
434
 
#        ex = Exercise(name=unicode(name))
435
 
#        store.add(ex)
436
 
#        store.commit()
437
 
#        return ex
438
424
 
439
425
class Worksheet(Storm):
440
426
    __storm_table__ = "worksheet"
442
428
    id = Int(primary=True, name="worksheetid")
443
429
    # XXX subject is not linked to a Subject object. This is a property of
444
430
    # the database, and will be refactored.
445
 
    subject = Unicode()
446
431
    offering_id = Int(name="offeringid")
447
432
    name = Unicode(name="identifier")
448
433
    assessable = Bool()