Ejemplo n.º 1
0
    def nb_uploaders_indicator(self, name):
        """FDC indicator with count of uploaders.

        This indicator is filled with values during q1, q2, q3, q4 and total.

        Args:
            name (str): name of the fdc_indicator

        Returns:
            fdc_indicator with the number of file for each quarter and total over the whole period
        """
        if self.nb_uploaders is None:
            self.nb_uploaders = [
                self.quarters[i].get_nb_uploaders() for i in range(4)
            ]

        cat = self.category.replace(" ", "_")
        query = wmflabs_queries.count_uploaders_in_category()
        self.cursor.execute(query, (cat, self.fdc_round.full_period()['start'],
                                    self.fdc_round.full_period()['end']))
        total = long(self.cursor.fetchone()[0])

        return fdc_indicator(name,
                             q1=self.nb_uploaders[0],
                             q2=self.nb_uploaders[1],
                             q3=self.nb_uploaders[2],
                             q4=self.nb_uploaders[3],
                             value=total)
Ejemplo n.º 2
0
    def nb_uploaders_indicator(self, name):
        """FDC indicator with count of uploaders.

        This indicator is filled with values during q1, q2, q3, q4 and total.

        Args:
            name (str): name of the fdc_indicator

        Returns:
            fdc_indicator with the number of file for each quarter and total over the whole period
        """
        if self.nb_uploaders is None:
            self.nb_uploaders = [
                self.quarters[i].get_nb_uploaders() for i in range(4)]

        cat = self.category.replace(" ", "_")
        query = wmflabs_queries.count_uploaders_in_category()
        self.cursor.execute(query, (cat, self.fdc_round.full_period()['start'], self.fdc_round.full_period()['end']))
        total = long(self.cursor.fetchone()[0])

        return fdc_indicator(name,
                             q1=self.nb_uploaders[0],
                             q2=self.nb_uploaders[1],
                             q3=self.nb_uploaders[2],
                             q4=self.nb_uploaders[3],
                             value=total)
 def get_nb_uploaders(self):
     """Amount of uploaders on the period."""
     query = wmflabs_queries.count_uploaders_in_category(self.catsql, self.timestamp1, self.timestamp2)
     self.cursor.execute(query)
     return long(self.cursor.fetchone()[0])
Ejemplo n.º 4
0
 def get_nb_uploaders(self):
     """Amount of uploaders on the period."""
     query = wmflabs_queries.count_uploaders_in_category()
     self.cursor.execute(query, (self.catsql, self.timestamp1, self.timestamp2))
     return long(self.cursor.fetchone()[0])