def get_report(self, talkid): """Returns a failure from a given talkid. Returned value is a Failure object""" result = QtSql.QSqlQuery('''SELECT * FROM failures WHERE Id = "%s"''' % talkid) if result.next(): failure = Failure(unicode(result.value(0).toString()), # id unicode(result.value(1).toString()), # comment unicode(result.value(2).toString()), # indicator result.value(3).toBool()) # release else: failure = None return failure
def report(self): talk_id = self.current_presentation_id() i = self.reportWidget.reportCombo.currentIndex() failure = Failure(talk_id, self.reportWidget.commentEdit.text(), self.reportWidget.options[i], self.reportWidget.releaseCheckBox.isChecked()) log.info("Report Failure: %s, %s, %s, release form? %s" % (talk_id, self.reportWidget.commentEdit.text(), self.reportWidget.options[i], self.reportWidget.releaseCheckBox.isChecked())) self.db.insert_failure(failure) self.reportWidget.close()
def get_reports(self): """Returns a list of failures in Report format""" result = QtSql.QSqlQuery('''Select * FROM failures''') list = [] while result.next(): failure = Failure(unicode(result.value(0).toString()), # id unicode(result.value(1).toString()), # comment unicode(result.value(2).toString()), # indicator bool(result.value(3))) # release p = self.get_presentation(failure.talkId) r = Report(p, failure) list.append(r) return list