def _process(self): stats = CategoryStatistics(self._target).getStatistics() if stats is not None: stats = stats.copy() if request.accept_mimetypes.best_match(("application/json", "text/html")) == "application/json": if stats is None: stats = {"events": None, "contributions": None, "files": None, "updated": None} else: stats = dict(stats) if stats["updated"]: stats["updated"] = stats["updated"].isoformat() return jsonify(stats) else: if stats is not None: plots, values, updated = _process_stats(stats, root=self._target.isRoot()) else: plots = values = updated = None return WPCategoryStatistics.render_template( "category_statistics.html", self._target, cat=self._target, plots=plots, values=values, updated=updated, has_stats=(stats is not None), )
def _process(self): if request.accept_mimetypes.best_match( ('application/json', 'text/html')) == 'application/json': return redirect( url_for('categories.statistics_json', category_id=self.category.id)) return WPCategoryStatistics.render_template('category_statistics.html', self.category)
def _get_stats_html(self, stats): plots, values, updated = self._process_stats( stats, root=self.category.is_root) return WPCategoryStatistics.render_template('category_statistics.html', self.category, plots=plots, values=values, updated=updated, has_stats=True)
def _process(self): stats = get_category_stats(int(self._target.getId())) if request.accept_mimetypes.best_match(('application/json', 'text/html')) == 'application/json': data = {'events': stats['events_by_year'], 'contributions': stats['contribs_by_year'], 'files': stats['attachments'], 'updated': stats['updated'].isoformat()} if self._target.isRoot(): data['users'] = _count_users() return jsonify(data) else: plots, values, updated = _process_stats(stats, root=self._target.isRoot()) return WPCategoryStatistics.render_template('category_statistics.html', self._target, cat=self._target, plots=plots, values=values, updated=updated, has_stats=True)
def _process(self): stats = CategoryStatistics(self._target).getStatistics().copy() if request.accept_mimetypes.best_match(('application/json', 'text/html')) == 'application/json': if stats is None: stats = {'events': None, 'contributions': None, 'files': None, 'updated': None} else: stats = dict(stats) if stats['updated']: stats['updated'] = stats['updated'].isoformat() return jsonify(stats) else: plots, values, updated = _process_stats(stats, root=self._target.isRoot()) return WPCategoryStatistics.render_template('category_statistics.html', self._target, cat=self._target, plots=plots, values=values, updated=updated)
def _process(self): stats = get_category_stats(int(self._target.getId())) if request.accept_mimetypes.best_match( ('application/json', 'text/html')) == 'application/json': data = { 'events': stats['events_by_year'], 'contributions': stats['contribs_by_year'], 'files': stats['attachments'], 'updated': stats['updated'].isoformat() } if self._target.isRoot(): data['users'] = _count_users() return jsonify(data) else: plots, values, updated = _process_stats(stats, root=self._target.isRoot()) return WPCategoryStatistics.render_template( 'category_statistics.html', self._target, cat=self._target, plots=plots, values=values, updated=updated, has_stats=True)
def _process(self): stats = CategoryStatistics(self._target).getStatistics() if stats is not None: stats = stats.copy() if request.accept_mimetypes.best_match(('application/json', 'text/html')) == 'application/json': if stats is None: stats = {'events': None, 'contributions': None, 'files': None, 'updated': None} else: stats = dict(stats) if stats['updated']: stats['updated'] = stats['updated'].isoformat() return jsonify(stats) else: if stats is not None: plots, values, updated = _process_stats(stats, root=self._target.isRoot()) else: plots = values = updated = None return WPCategoryStatistics.render_template('category_statistics.html', self._target, cat=self._target, plots=plots, values=values, updated=updated, has_stats=(stats is not None))
def _get_stats_html(self, stats): plots, values, updated = self._process_stats(stats, root=self.category.is_root) return WPCategoryStatistics.render_template('category_statistics.html', self.category, plots=plots, values=values, updated=updated, has_stats=True)