コード例 #1
0
    def _updateMaloneStatistics(self, ztm):
        self.update('bug_count', Bug.select().count())
        ztm.commit()

        self.update('bugtask_count', BugTask.select().count())
        ztm.commit()

        self.update(
                'products_using_malone',
                Product.selectBy(official_malone=True).count())
        ztm.commit()

        cur = cursor()
        cur.execute(
            "SELECT COUNT(DISTINCT product) + COUNT(DISTINCT distribution) "
            "FROM BugTask")
        self.update("projects_with_bugs", cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute(
            "SELECT COUNT(*) FROM (SELECT COUNT(distinct product) + "
            "                             COUNT(distinct distribution) "
            "                             AS places "
            "                             FROM BugTask GROUP BY bug) "
            "                      AS temp WHERE places > 1")
        self.update("shared_bug_count", cur.fetchone()[0] or 0)
        ztm.commit()
コード例 #2
0
ファイル: statistics.py プロジェクト: pombredanne/launchpad-3
    def _updateMaloneStatistics(self, ztm):
        self.update('bug_count', Bug.select().count())
        ztm.commit()

        self.update('bugtask_count', BugTask.select().count())
        ztm.commit()

        self.update(
                'products_using_malone',
                Product.selectBy(official_malone=True).count())
        ztm.commit()

        cur = cursor()
        cur.execute(
            "SELECT COUNT(DISTINCT product) + COUNT(DISTINCT distribution) "
            "FROM BugTask")
        self.update("projects_with_bugs", cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute(
            "SELECT COUNT(*) FROM (SELECT COUNT(distinct product) + "
            "                             COUNT(distinct distribution) "
            "                             AS places "
            "                             FROM BugTask GROUP BY bug) "
            "                      AS temp WHERE places > 1")
        self.update("shared_bug_count", cur.fetchone()[0] or 0)
        ztm.commit()
コード例 #3
0
ファイル: statistics.py プロジェクト: pombredanne/launchpad-3
    def _updateRosettaStatistics(self, ztm):
        self.update(
                'products_using_rosetta',
                Product.selectBy(
                    translations_usage=ServiceUsage.LAUNCHPAD).count())
        self.update('potemplate_count', POTemplate.select().count())
        ztm.commit()
        self.update('pofile_count', POFile.select().count())
        ztm.commit()
        self.update('pomsgid_count', POMsgID.select().count())
        ztm.commit()
        self.update('language_count', Language.select(
            "POFile.language=Language.id",
            clauseTables=['POFile'],
            distinct=True).count())
        ztm.commit()

        cur = cursor()
        cur.execute(
            "SELECT COUNT(DISTINCT submitter) FROM TranslationMessage")
        self.update('translator_count', cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute("""
            SELECT COUNT(DISTINCT submitter)
            FROM TranslationMessage
            WHERE origin=2
            """)
        self.update('rosetta_translator_count', cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute("""
            SELECT COUNT(DISTINCT product) FROM ProductSeries,POTemplate
            WHERE ProductSeries.id = POTemplate.productseries
            """)
        self.update('products_with_potemplates', cur.fetchone()[0] or 0)
        ztm.commit()
コード例 #4
0
    def _updateRosettaStatistics(self, ztm):
        self.update(
                'products_using_rosetta',
                Product.selectBy(
                    translations_usage=ServiceUsage.LAUNCHPAD).count())
        self.update('potemplate_count', POTemplate.select().count())
        ztm.commit()
        self.update('pofile_count', POFile.select().count())
        ztm.commit()
        self.update('pomsgid_count', POMsgID.select().count())
        ztm.commit()
        self.update('language_count', Language.select(
            "POFile.language=Language.id",
            clauseTables=['POFile'],
            distinct=True).count())
        ztm.commit()

        cur = cursor()
        cur.execute(
            "SELECT COUNT(DISTINCT submitter) FROM TranslationMessage")
        self.update('translator_count', cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute("""
            SELECT COUNT(DISTINCT submitter)
            FROM TranslationMessage
            WHERE origin=2
            """)
        self.update('rosetta_translator_count', cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute("""
            SELECT COUNT(DISTINCT product) FROM ProductSeries,POTemplate
            WHERE ProductSeries.id = POTemplate.productseries
            """)
        self.update('products_with_potemplates', cur.fetchone()[0] or 0)
        ztm.commit()
コード例 #5
0
 def _updateRegistryStatistics(self, ztm):
     self.update('active_products',
                 Product.select("active IS TRUE", distinct=True).count())
     self.update(
         'products_with_translations',
         Product.select('''
             POTemplate.productseries = ProductSeries.id AND
             Product.id = ProductSeries.product AND
             Product.active = TRUE
             ''',
                        clauseTables=['ProductSeries', 'POTemplate'],
                        distinct=True).count())
     self.update(
         'products_with_blueprints',
         Product.select(
             "Specification.product=Product.id AND Product.active IS TRUE",
             distinct=True,
             clauseTables=['Specification']).count())
     self.update(
         'products_with_branches',
         Product.select(
             "Branch.product=Product.id AND Product.active IS TRUE",
             distinct=True,
             clauseTables=['Branch']).count())
     self.update(
         'products_with_bugs',
         Product.select(
             "BugTask.product=Product.id AND Product.active IS TRUE",
             distinct=True,
             clauseTables=['BugTask']).count())
     self.update(
         'products_with_questions',
         Product.select(
             "Question.product=Product.id AND Product.active IS TRUE",
             distinct=True,
             clauseTables=['Question']).count())
     self.update(
         'reviewed_products',
         Product.selectBy(project_reviewed=True, active=True).count())
コード例 #6
0
 def _updateRegistryStatistics(self, ztm):
     self.update(
         'active_products',
         Product.select("active IS TRUE", distinct=True).count())
     self.update(
         'products_with_translations',
         Product.select('''
             POTemplate.productseries = ProductSeries.id AND
             Product.id = ProductSeries.product AND
             Product.active = TRUE
             ''',
             clauseTables=['ProductSeries', 'POTemplate'],
             distinct=True).count())
     self.update(
         'products_with_blueprints',
         Product.select(
             "Specification.product=Product.id AND Product.active IS TRUE",
             distinct=True, clauseTables=['Specification']).count())
     self.update(
         'products_with_branches',
         Product.select(
             "Branch.product=Product.id AND Product.active IS TRUE",
             distinct=True, clauseTables=['Branch']).count())
     self.update(
         'products_with_bugs',
         Product.select(
             "BugTask.product=Product.id AND Product.active IS TRUE",
             distinct=True, clauseTables=['BugTask']).count())
     self.update(
         'products_with_questions',
         Product.select(
             "Question.product=Product.id AND Product.active IS TRUE",
             distinct=True, clauseTables=['Question']).count())
     self.update(
         'reviewed_products',
         Product.selectBy(project_reviewed=True, active=True).count())
コード例 #7
0
    def products(self):
        """See `ITranslationGroup`."""
        # Avoid circular imports.
        from lp.registry.model.product import Product

        return Product.selectBy(translationgroup=self.id, active=True)
コード例 #8
0
    def products(self):
        """See `ITranslationGroup`."""
        # Avoid circular imports.
        from lp.registry.model.product import Product

        return Product.selectBy(translationgroup=self.id, active=True)