Example #1
 def getquickstats(self):
     """calculate aggregate stats for all directory based on stats
     of all descenging stores and dirs"""
     if self.is_template_project:
         #FIXME: Hackish return empty_stats to avoid messing up
         # with project and language stats
         return empty_quickstats
     #FIXME: can we replace this with a quicker path query?
     file_result = statssum(self.child_stores.iterator())
     dir_result  = statssum(self.child_dirs.iterator())
     stats = dictsum(file_result, dir_result)
     return stats
Example #2
    def get_raw_stats_for_path(self, pootle_path):
        """Return a raw stats dictionary for this goal inside the given path.

        If this is a project goal the stats returned are the ones for the
        stores in the given path that correspond to the stores inside this goal
        that are present in the matching path in the 'templates' TP.

        :param pootle_path: A string with a valid pootle path.
        # Retrieve the stores for this goal in the path.
        tp_stores_for_this_goal = self.get_stores_for_path(pootle_path)

        # Get and sum the stats for the stores.
        quickstats = statssum(tp_stores_for_this_goal)
        stats = get_processed_stats(add_percentages(quickstats))

        # Get and sum the suggestion counts for the stores.
        stats['suggestions'] = suggestions_sum(tp_stores_for_this_goal)

        return stats
Example #3
 def getquickstats(self):
     return statssum(self.translationproject_set.iterator())