~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 02:03:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: grantw@unimelb.edu.au-20090120020332-oi1xk22zpb0iodfz
ivle.database.Offering: Add a members ReferenceSet.
www/apps/userservice: Replace get_{projectgroup,offering}_members calls with
    Storm ones, constructing the dict-lists manually as usual.
ivle.db.get_{offering,projectgroup}_members: Kill. Unused.

Show diffs side-by-side

added added

removed removed

Lines of Context:
433
433
            result['active'] = _parse_boolean(result['active'])
434
434
        return results
435
435
 
436
 
    def get_offering_members(self, offeringid, dry=False):
437
 
        """
438
 
        Gets the logins of all the people enroled in an offering
439
 
        """
440
 
        query = """\
441
 
SELECT login.login AS login, login.fullname AS fullname
442
 
FROM login, enrolment
443
 
WHERE login.loginid = enrolment.loginid AND
444
 
    enrolment.offeringid = %d
445
 
    ORDER BY login.login;"""%offeringid
446
 
        if dry:
447
 
            return query
448
 
        return self.db.query(query).dictresult()
449
 
 
450
 
 
451
436
    def get_enrolment_groups(self, login, offeringid, dry=False):
452
437
        """
453
438
        Get all groups the user is member of in the given offering.
485
470
            return query
486
471
        return self.db.query(query).dictresult()[0]
487
472
 
488
 
    def get_projectgroup_members(self, groupid, dry=False):
489
 
        """Returns the logins of all students in a project group
490
 
        """
491
 
        query = """\
492
 
SELECT login.login as login, login.fullname as fullname
493
 
FROM login, group_member
494
 
WHERE login.loginid = group_member.loginid AND
495
 
    group_member.groupid = %d
496
 
ORDER BY login.login;"""%groupid
497
 
        if dry:
498
 
            return query
499
 
        return self.db.query(query).dictresult()
500
 
 
501
473
    def close(self):
502
474
        """Close the DB connection. Do not call any other functions after
503
475
        this. (The behaviour of doing so is undefined).