def serialize(self): totalgroups = len(self.allgroups) return { 'id': self.examiner.user_id, 'examiner': { 'id': self.examiner.id, 'user': serialize_user(self.examiner.user) }, 'waitingfordeliveries_count': self.waitingfordeliveries_count, 'waitingforfeedback_count': self.waitingforfeedback_count, 'nodeadlines_count': self.nodeadlines_count, 'closedwithoutfeedback_count': self.closedwithoutfeedback_count, 'failed_count': self.failed_count, 'passed_count': self.passed_count, 'corrected_count': self.failed_count + self.passed_count, 'waitingfordeliveries_percent': self._percentage(self.waitingfordeliveries_count, totalgroups), 'waitingforfeedback_percent': self._percentage(self.waitingforfeedback_count, totalgroups), 'nodeadlines_percent': self._percentage(self.nodeadlines_count, totalgroups), 'closedwithoutfeedback_percent': self._percentage(self.closedwithoutfeedback_count, totalgroups), 'failed_percent': self._percentage(self.failed_count, totalgroups), 'passed_percent': self._percentage(self.passed_count, totalgroups), 'corrected_percent': self._percentage(self.failed_count + self.passed_count, totalgroups), 'groups': self._serialize_groups(self.allgroups), 'points_best': self.points_best, 'points_worst': self.points_worst, 'points_avg': self.points_avg, 'feedback_words_avg': self.feedback_words_avg }
def _serialize_status(self, status, includedetails=True): if not status: return None out = { 'id': status.id, 'period': status.period.id, 'status': status.status, 'statustext': unicode(status.getStatusText()), 'createtime': status.createtime, 'message': status.message, 'user': serialize_user(status.user), 'plugin': status.plugin } if status.plugin: out['plugin_title'] = unicode(qualifiesforexam_plugins.get_title(status.plugin)) if includedetails: out['passing_relatedstudentids_map'] = self._create_passing_relatedstudentids_map(status) if status.plugin: out['pluginsettings_summary'] = qualifiesforexam_plugins.get_pluginsettings_summary(status) out['plugin_description'] = unicode(qualifiesforexam_plugins.get_description(status.plugin)) return out
def _serialize_status(self, status, includedetails=True): if not status: return None out = { "id": status.id, "period": status.period.id, "status": status.status, "statustext": unicode(status.getStatusText()), "createtime": status.createtime, "message": status.message, "user": serialize_user(status.user), "plugin": status.plugin, } if status.plugin: out["plugin_title"] = unicode(qualifiesforexam_plugins.get_title(status.plugin)) if includedetails: out["passing_relatedstudentids_map"] = self._create_passing_relatedstudentids_map(status) if status.plugin: out["pluginsettings_summary"] = qualifiesforexam_plugins.get_pluginsettings_summary(status) out["plugin_description"] = unicode(qualifiesforexam_plugins.get_description(status.plugin)) return out