]> git.zarvox.org Git - wp3.git/blobdiff - pagecommit.py
Added Python docstrings for all classes.
[wp3.git] / pagecommit.py
index 31a6f3379b0aca780d1ace64ce3957cb4def76b6..847b47b272b9caab6525c7bd42d4dc6e8fdd3bee 100644 (file)
@@ -4,6 +4,7 @@ from PyQt4.QtSql import *
 
 class PageCommit(QWizardPage):
        def __init__(self, parent=None, db=None):
+               """Set up widgets and message to have picture taken."""
                QWizardPage.__init__(self,parent)
                self.db = db
                self.instructions = QLabel("You're done with the computer.  Go have your picture taken.\n\nThe SAs/PAs will add the photo to your data.")
@@ -15,6 +16,7 @@ class PageCommit(QWizardPage):
                self.setSubTitle("Photo")
 
        def initializePage(self):
+               """Add data collected from previous pages to database."""
                q = QSqlQuery(self.db)
                q.prepare("INSERT INTO people (netid, forename, surname, email, birthday, phone, major, dorm, room, createtime, mtime )"
                                "VALUES (:netid, :forename, :surname, :email, :birthday, :phone, :major, :dorm, :room, :createtime, :mtime )" );
@@ -22,14 +24,14 @@ class PageCommit(QWizardPage):
                q.bindValue(":forename", self.field("forename") )
                q.bindValue(":surname", self.field("surname") )
                q.bindValue(":email", self.field("email") )
-               y = self.field("year").toInt()[0] + 1987
+               y = self.field("year").toInt()[0] + 1983
                m = self.field("month").toInt()[0] + 1
                d = self.field("day").toInt()[0] + 1
                bday = QDate(y,m,d)
                q.bindValue(":birthday", QVariant(bday.toString(Qt.ISODate)) )
                q.bindValue(":phone", self.field("phone") )
                q.bindValue(":major", self.field("major") )
-               q.bindValue(":dorm", self.field("dorm") )
+               q.bindValue(":dorm", QVariant(QString(["","Clements","Lechner","McFadden"][self.field("dorm").toInt()[0]])) )
                q.bindValue(":room", self.field("room") )
                q.bindValue(":createtime", QVariant(QDateTime.currentDateTime().toString(Qt.ISODate)) )
                q.bindValue(":mtime", QVariant(QDateTime.currentDateTime().toString(Qt.ISODate)) )