Newer
Older
def stringify_percentage(self):
if self.state == grade_state_change_types.graded:
if self.valid_percentages:
return "%.1f" % self.percentage()
else:
return u""
else:
return ""
# }}}
# {{{ flow <-> grading integration
def get_flow_grading_opportunity(course, flow_id, flow_desc, grading_rule):
from course.utils import FlowSessionGradingRule
assert isinstance(grading_rule, FlowSessionGradingRule)
gopp, created = GradingOpportunity.objects.get_or_create(
course=course,
identifier=grading_rule.grade_identifier,
defaults=dict(
name="Flow: %s" % flow_desc.title,
aggregation_strategy=grading_rule.grade_aggregation_strategy,
# {{{ XMPP log
class InstantMessage(models.Model):
participation = models.ForeignKey(Participation)
text = models.CharField(max_length=200)
time = models.DateTimeField(default=now)
class Meta:
ordering = ("participation__course", "time")
def __unicode__(self):
return "%s: %s" % (self.participation, self.text)
# }}}
# vim: foldmethod=marker