Exemple #1
0
 def get_ajax(self):
     group_stat = GroupStat.get_unique(group=self.get_group(), date=datetime.date.today())
     if group_stat is not None:
         top_posters = PosterStat.find_by_group_stat(group_stat=group_stat, limit=3)
     else:
         top_posters = None
     return {"group_stat": group_stat, "top_posters": top_posters}
Exemple #2
0
 def get_page(self):
     group_stat = GroupStat.get_unique(group=self.get_group(), date=self.date)
     if group_stat is not None:
         top_posters = PosterStat.find_by_group_stat(group_stat=group_stat, limit=10)
     else:
         top_posters = None
     data = {"group_stat": group_stat, "top_posters": top_posters}
     data = self.update_data(data)
     return render_to_response(self.get_page_template(), data, RequestContext(self.request))
Exemple #3
0
 def _send_top_posters(self, group):
     group_stat = GroupStat.get_unique(group=group, date=datetime.date.today(), month_delta=-1)
     if not group_stat:
         return 0
     top_posters = PosterStat.find_by_group_stat(group_stat=group_stat, limit=3)
     if not top_posters:
         return 0
     data = {
         "group_stat": group_stat,
         "top_posters": top_posters,
         "http_host": getattr(settings, "MY_HTTP_HOST", None),
     }
     message = render_to_string("cronjobs/mails/top_posters.txt", data)
     author = users.get_user(self.FROM_EMAIL)
     recipient = "*****@*****.**" % group.google_group
     something_happened.send(
         sender=Group.__name__,
         subject=None,
         message=message,
         author=author,
         recipients=[recipient]
     )
     return 1