本文整理匯總了Python中MOSES.getFeedbackBetweenDates方法的典型用法代碼示例。如果您正苦於以下問題:Python MOSES.getFeedbackBetweenDates方法的具體用法?Python MOSES.getFeedbackBetweenDates怎麽用?Python MOSES.getFeedbackBetweenDates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MOSES
的用法示例。
在下文中一共展示了MOSES.getFeedbackBetweenDates方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: populateReport
# 需要導入模塊: import MOSES [as 別名]
# 或者: from MOSES import getFeedbackBetweenDates [as 別名]
def populateReport(self):
# print "Populating report"
entity_types = self.type_combo_box.getCheckedItems()
if len(entity_types) == 0:
entity_types = None
data = MOSES.getFeedbackBetweenDates(self.user_id, self.password, self.start_date_edit.date().toPyDate(), self.end_date_edit.date().toPyDate(), entity_types)
if data["total"] != 0:
self.helpfulness_report_table.setRowCount(1)
self.helpfulness_report_table.setColumnCount(4)
self.helpfulness_report_table.setHorizontalHeaderLabels(["Yes","No","Total","Helpfulness%"])
self.helpfulness_report_table.setItem(0,0,QtGui.QTableWidgetItem(str(data["yes"])))
self.helpfulness_report_table.setItem(0,1,QtGui.QTableWidgetItem(str(data["total"]-data["yes"])))
self.helpfulness_report_table.setItem(0,2,QtGui.QTableWidgetItem(str(data["total"])))
self.helpfulness_report_table.setItem(0,3,QtGui.QTableWidgetItem("%.2f%%"%(100*data["yes"]/data["total"])))
#print data["data"][0].keys()
data_headers = ["Time Stamp","Article Type","Item ID","FSN","Feedback","Feedback Comment"]
table_rows = len(data["data"])
self.helpfulness_data_table.setSortingEnabled(False)
self.helpfulness_data_table.setRowCount(table_rows)
self.helpfulness_data_table.setColumnCount(len(data_headers))
self.helpfulness_data_table.setHorizontalHeaderLabels(data_headers)
for row_index in range(table_rows):
self.helpfulness_data_table.setItem(row_index,0,QtGui.QTableWidgetItem(str(data["data"][row_index]["create_stamp"])))
self.helpfulness_data_table.setItem(row_index,1,QtGui.QTableWidgetItem(str(data["data"][row_index]["entity_type"])))
self.helpfulness_data_table.setItem(row_index,2,QtGui.QTableWidgetItem(str(data["data"][row_index]["entity_id"])))
self.helpfulness_data_table.setItem(row_index,3,QtGui.QTableWidgetItem(str(data["data"][row_index]["FSN"])))
self.helpfulness_data_table.setItem(row_index,4,QtGui.QTableWidgetItem(str(data["data"][row_index]["feedback"])))
self.helpfulness_data_table.setItem(row_index,5,QtGui.QTableWidgetItem(str(data["data"][row_index]["metadata"])))
self.helpfulness_data_table.setSortingEnabled(True)
self.helpfulness_data_table.resizeColumnsToContents()
self.helpfulness_data_table.setColumnWidth(5,200)
self.helpfulness_data_table.setWordWrap(True)
self.helpfulness_data_table.resizeRowsToContents()
self.alertMessage("Completed!","Finished summarizing feedback data for the selected entity types between %s and %s" %(self.start_date_edit.date().toPyDate(), self.end_date_edit.date().toPyDate()))
else:
self.alertMessage("No Data Available!","There is no feedback available for the selected entity types between %s and %s" %(self.start_date_edit.date().toPyDate(), self.end_date_edit.date().toPyDate()))