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