Ejemplo n.º 1
0
    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),
            )
Ejemplo n.º 2
0
    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))
Ejemplo n.º 3
0
 def run(self):
     from MaKaC.statistics import CategoryStatistics
     CategoryStatistics.updateStatistics(self._cat,
                                         self.getLogger())
Ejemplo n.º 4
0
def category_stats(category_id='0'):
    CategoryStatistics.updateStatistics(CategoryManager().getById(category_id), logger)
Ejemplo n.º 5
0
 def run(self):
     CategoryStatistics.updateStatistics(self._cat)
Ejemplo n.º 6
0
 def run( self ):
     CategoryStatistics.updateStatistics(self._cat)
Ejemplo n.º 7
0
def category_stats(category_id='0'):
    CategoryStatistics.updateStatistics(CategoryManager().getById(category_id),
                                        logger)
Ejemplo n.º 8
0
 def run(self):
     from MaKaC.statistics import CategoryStatistics
     CategoryStatistics.updateStatistics(self._cat, self.getLogger())