Beispiel #1
0
 def _run(self):
     page = self._page
     self.submitted = bool(page)
     if not page:
         self.comments = 0
         self.endorsements = 0
         self.promotions = 0
         self.incomplete_reasons = []
         return
     self.comments = page.comments.count(limit=COUNT_LIMIT)
     self.endorsements = Annotation.endorsements(page).count(limit=COUNT_LIMIT)
     self._set_promotion_texts()
     self.promotions = len(self.promotion_texts)
     self.incomplete_reasons = [inc.reason for inc in Annotation.incompletes(page).run(limit=10)]
     self.timestamp = datetime.datetime.now()
Beispiel #2
0
 def render_unit(self):
     fields = {
             k: Markup(v) for k,v in self.unit.wiki_fields.iteritems()}
     fields['reflection'] = Markup('<p><i>Removed from this view for peers\' privacy.<br>--BOOC Instructors and Tech Staff</i></p>')
     self.template_value['fields'] = fields
     self.template_value['unit'] = self.find_unit_by_id(self.unit_num)
     self.template_value['report'] = self.unit
     self.template_value['badge_slug'] = self.report.badge.key().name()
     # THIS is kinda magic - we render a page like wf_temp_u1.html, but have
     # it inherit from wf_evidence.html rather than wf_page.html.  This
     # removes the comment section, for instance.
     self.template_value['layout_template'] = 'wf_evidence.html'
     self.template_value['review'] = Annotation.reviews(whose=self.report.student, unit=self.unit_num).get()
     self.render(page_templates.templates[self.unit_num])
Beispiel #3
0
 def _set_exemplary_count(self):
     self.exemplary_count = Annotation.exemplaries(whose=self.student_key).count(limit=500)
Beispiel #4
0
 def _set_promotion_texts(self):
     promos = Annotation.exemplaries(self._page).run(limit=COUNT_LIMIT)
     self.promotion_texts = [p.reason for p in promos]