当前位置: 首页>>代码示例>>Python>>正文


Python ITS._get_closed_condition方法代码示例

本文整理汇总了Python中vizgrimoire.ITS.ITS._get_closed_condition方法的典型用法代码示例。如果您正苦于以下问题:Python ITS._get_closed_condition方法的具体用法?Python ITS._get_closed_condition怎么用?Python ITS._get_closed_condition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vizgrimoire.ITS.ITS的用法示例。


在下文中一共展示了ITS._get_closed_condition方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_list

# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import _get_closed_condition [as 别名]
    def get_list(self):
        startdate = self.filters.startdate
        enddate = self.filters.enddate
        closed_condition = ITS._get_closed_condition()
        if self.filters.closed_condition is not None:
             closed_condition = self.filters.closed_condition


        q = "select cou.name "+\
            "from issues i, "+\
            "     changes ch, "+\
            "     people_uidentities pup, "+\
            "     "+ self.db.identities_db+ ".profiles pro, "+\
            "     "+ self.db.identities_db+ ".countries cou "+\
            "where i.id = ch.issue_id and "+\
            "      ch.changed_by = pup.people_id and "+\
            "      pup.uuid = pro.uuid and "+\
            "      pro.country_code = cou.code and "+\
            "      ch.changed_on >= "+ startdate+ " and "+\
            "      ch.changed_on < "+ enddate+" and "+\
            "      "+ closed_condition+ " "+\
            "      group by cou.name  "+\
            "      order by count(distinct(i.id)) desc, cou.name"
        data = self.db.ExecuteQuery(q)
        return (data)
开发者ID:jsmanrique,项目名称:GrimoireLib,代码行数:27,代码来源:its_metrics.py

示例2: __get_sql_default__

# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import _get_closed_condition [as 别名]
    def __get_sql_default__(self, evolutionary, close = False):
        # closed_condition =  ITS._get_closed_condition()

        fields = Set([])
        tables = Set([])
        filters = Set([])

        fields.add("count(distinct(pup.uuid)) as changers")
        tables.add("issues i")
        tables.add("changes ch")
        tables.union_update(self.db.GetSQLReportFrom(self.filters))
        filters.add("i.id = ch.issue_id")
        if close:
            fields = Set([])
            fields.add("count(distinct(pup.uuid)) as closers")
            closed_condition =  ITS._get_closed_condition()
            if self.filters.closed_condition is not None:
                 closed_condition = self.filters.closed_condition

            filters.add(closed_condition)
        filters.union_update(self.db.GetSQLReportWhere(self.filters))
        #unique identities filters
        tables.add("people_uidentities pup")
        filters.add("i.submitted_by = pup.people_id")

        query = self.db.BuildQuery(self.filters.period, self.filters.startdate,
                               self.filters.enddate, " ch.changed_on ",
                               fields, tables, filters, evolutionary,
                               self.filters.type_analysis)
        #Action needed to replace issues filters by changes one
        query = query.replace("i.submitted", "ch.changed")
        return query
开发者ID:jsmanrique,项目名称:GrimoireLib,代码行数:34,代码来源:its_metrics.py

示例3: _get_top_repository

# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import _get_closed_condition [as 别名]
    def _get_top_repository (self, metric_filters, days = None):
        startdate = metric_filters.startdate
        enddate = metric_filters.enddate
        repo_name = metric_filters.type_analysis[1]
        limit = metric_filters.npeople
        filter_bots = self.db.get_bots_filter_sql(self.data_source, metric_filters)
        closed_condition =  ITS._get_closed_condition()
        if self.filters.closed_condition is not None:
             closed_condition = self.filters.closed_condition

        if filter_bots != '': filter_bots = " AND " + filter_bots

        dtables = dfilters = ""
        if (days > 0):
            dtables = ", (SELECT MAX(changed_on) as last_date from changes) t "
            dfilters = " AND DATEDIFF (last_date, changed_on) < %s " % (days)

        q = "SELECT up.uuid as id, up.identifier as closers, "+\
            "COUNT(DISTINCT(i.id)) as closed "+\
            "FROM issues i, changes c, trackers t, people_uidentities pup, " +\
            "     "+self.db.identities_db+".uidentities up "+ dtables + \
            "WHERE "+closed_condition+" "+\
            "      AND pup.uuid = up.uuid "+\
            "      AND c.changed_by = pup.people_id "+\
            "      AND c.issue_id = i.id "+\
            "      AND i.tracker_id = t.id "+\
            "      AND t.url = "+repo_name+" "+\
            "      AND changed_on >= "+startdate+" AND changed_on < " +enddate +\
            "      " + filter_bots + " " + dfilters + \
            " GROUP BY up.identifier ORDER BY closed DESC, closers LIMIT " + str(limit)
        data = self.db.ExecuteQuery(q)
        return (data)
开发者ID:jsmanrique,项目名称:GrimoireLib,代码行数:34,代码来源:its_metrics.py

示例4: get_agg

# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import _get_closed_condition [as 别名]
    def get_agg(self):
        fields = Set([])
        tables = Set([])
        filters = Set([])

        fields.add("TIMESTAMPDIFF(SECOND, i.submitted_on, t1.changed_on) as timeto")
        tables.add("issues i")
        tables.union_update(self.db.GetSQLReportFrom(self.filters))

        closed_condition = ITS._get_closed_condition()
        if self.filters.closed_condition is not None:
             closed_condition = self.filters.closed_condition

        # TODO: if RESOLVED and CLOSED appear in the same period of study, this 
        # will affect the total time to close the issue. Both timeframes will
        # be taken into account.
        table_extra = "(select issue_id, changed_on from changes where "+closed_condition+" and changed_on < "+self.filters.enddate+" and changed_on >= "+self.filters.startdate+") t1"
        tables.add(table_extra)

        filters.add("i.id=t1.issue_id")
        filters.union_update(self.db.GetSQLReportWhere(self.filters))

        query = "select " + self.db._get_fields_query(fields)
        query = query + " from " + self.db._get_tables_query(tables)
        query = query + " where " + self.db._get_filters_query(filters)

        return self.db.ExecuteQuery(query)
开发者ID:jsmanrique,项目名称:GrimoireLib,代码行数:29,代码来源:its_metrics.py

示例5: get_list

# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import _get_closed_condition [as 别名]
    def get_list(self, metric_filters = None, days = 0):

        # Overwriting the filters used. This code should be
        # removed at some point.
        if metric_filters is not None:
            metric_filters_orig = self.filters
            self.filters = metric_filters

        startdate = metric_filters.startdate
        enddate = metric_filters.enddate
        limit = metric_filters.npeople
        filter_bots = self.db.get_bots_filter_sql(self.data_source, metric_filters)
        closed_condition =  ITS._get_closed_condition()
        if self.filters.closed_condition is not None:
             closed_condition = self.filters.closed_condition

        dtables = Set([])
        dfilters = Set([])
        if (days > 0):
            dtables.add("(SELECT MAX(changed_on) as last_date from changes) t")
            dfilters.add("DATEDIFF (last_date, changed_on) < %s " % (days))

        fields = Set([])
        tables = Set([])
        filters = Set([])

        fields.add("up.uuid as id")
        fields.add("pro.name as closers")
        fields.add("COUNT(DISTINCT(ch.id)) as closed")

        tables.union_update(self.db.GetSQLReportFrom(self.filters))
        tables.add("people_uidentities pup")
        tables.add(self.db.identities_db+".uidentities up")
        tables.add(self.db.identities_db + ".profiles pro")
        tables.add("issues i")
        tables.add("changes ch")
        tables.union_update(dtables)

        filters.union_update(self.db.GetSQLReportWhere(self.filters))
        filters.add(closed_condition)
        filters.add("i.id = ch.issue_id")
        filters.add("ch.changed_by = pup.people_id")
        filters.add("pup.uuid = up.uuid")
        filters.add("pup.uuid = pro.uuid")
        filters.add("ch.changed_on >= " + startdate)
        filters.add("ch.changed_on < " + enddate)
        filters.union_update(dfilters)
        if len(filter_bots) > 0:
            filters.add(filter_bots)

        query = "select " + self.db._get_fields_query(fields)
        query = query + " from " + self.db._get_tables_query(tables)
        query = query + " where " + self.db._get_filters_query(filters)
        query = query + " GROUP BY pro.name ORDER BY closed DESC, closers LIMIT " + str(limit)

        if metric_filters is not None: self.filters = metric_filters_orig

        return self.db.ExecuteQuery(query)
开发者ID:VizGrimoire,项目名称:GrimoireLib,代码行数:60,代码来源:its_metrics.py

示例6: __get_sql_trk_prj__

# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import _get_closed_condition [as 别名]
    def __get_sql_trk_prj__(self, evolutionary, close = False):
        # First get changers and then join with people_upeople
        fields = Set([])
        tables = Set([])
        filters = Set([])

        # TODO: double check this, it does not make sense that distinct without a group action
        fields.add("distinct(changed_by) as cpeople, changed_on")
        #fields.add("changed_on")
        tables.add("issues i")
        tables.add("changes ch")
        tables.union_update(self.db.GetSQLReportFrom(self.filters))
        filters.add("i.id = ch.issue_id")

        if close:
            closed_condition =  ITS._get_closed_condition()
            if self.filters.closed_condition is not None:
                 closed_condition = self.filters.closed_condition

            filters.add(closed_condition)

        filters.union_update(self.db.GetSQLReportWhere(self.filters))

        tpeople_sql = "select " + self.db._get_fields_query(fields)
        tpeople_sql = tpeople_sql + " from " + self.db._get_tables_query(tables)
        tpeople_sql = tpeople_sql + " where " + self.db._get_filters_query(filters)

        fields = Set([])
        tables = Set([])
        filters = Set([])

        fields.add("count(distinct(pup.uuid)) as changers")
        tables.add("people_uidentities pup")
        tables_str = "(%s) tpeople " % (tpeople_sql)
        tables.add(tables_str)
        filters.add("tpeople.cpeople = pup.people_id")

        if close:
            fields = Set([])
            fields.add("count(distinct(pup.uuid)) as closers")

        query = self.db.BuildQuery(self.filters.period, self.filters.startdate,
                               self.filters.enddate, " tpeople.changed_on ",
                               fields, tables, filters, evolutionary,
                               self.filters.type_analysis)
        return query
开发者ID:jsmanrique,项目名称:GrimoireLib,代码行数:48,代码来源:its_metrics.py

示例7: _get_top

# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import _get_closed_condition [as 别名]
    def _get_top(self, days = 0, metric_filters = None):
        if metric_filters == None:
            metric_filters = self.filters

        tables_set = self.db.GetTablesOwnUniqueIds("changes")
        filters_set = self.db.GetFiltersOwnUniqueIds("changes")
        tables = self.db._get_tables_query(tables_set)
        filters = self.db._get_filters_query(filters_set)

        startdate = metric_filters.startdate
        enddate = metric_filters.enddate
        limit = metric_filters.npeople
        filter_bots = self.db.get_bots_filter_sql(self.data_source, metric_filters)
        if filter_bots != "": filter_bots += " AND "
        closed_condition =  ITS._get_closed_condition()
        if self.filters.closed_condition is not None:
             closed_condition = self.filters.closed_condition


        dtables = dfilters = ""
        if (days > 0):
            dtables = ", (SELECT MAX(changed_on) as last_date from changes) t "
            dfilters = " AND DATEDIFF (last_date, changed_on) < %s " % (days)

        q = "SELECT up.uuid as id, up.identifier as closers, "+\
            "       count(distinct(c.id)) as closed "+\
            "FROM  "+tables+\
            ",     "+self.db.identities_db+".uidentities up "+ dtables +\
            "WHERE "+filter_bots + filters + " and "+\
            "      c.changed_by = pup.people_id and "+\
            "      pup.uuid = up.uuid and "+\
            "      c.changed_on >= "+ startdate+ " and "+\
            "      c.changed_on < "+ enddate+ " and " +\
            "      " + closed_condition + " " + dfilters+ " "+\
            "GROUP BY up.identifier "+\
            "ORDER BY closed desc, closers "+\
            "LIMIT "+ str(limit)

        data = self.db.ExecuteQuery(q)

        if not isinstance(data['id'], list):
            data = {item: [data[item]] for item in data}

        return (data)
开发者ID:jsmanrique,项目名称:GrimoireLib,代码行数:46,代码来源:its_metrics.py

示例8: _get_top_domain

# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import _get_closed_condition [as 别名]
    def _get_top_domain (self, metric_filters, days = None):
        startdate = metric_filters.startdate
        enddate = metric_filters.enddate
        domain_name = metric_filters.type_analysis[1]
        limit = metric_filters.npeople
        filter_bots = self.db.get_bots_filter_sql(self.data_source, metric_filters)
        closed_condition =  ITS._get_closed_condition()
        if self.filters.closed_condition is not None:
             closed_condition = self.filters.closed_condition


        fields = Set([])
        tables = Set([])
        filters = Set([])

        fields.add("up.uuid as id")
        fields.add("up.identifier as closers")
        fields.add("COUNT(DISTINCT(c.id)) as closed")

        tables.union_update(self.db.GetTablesDomains(self.db.identities_db))
        tables.add(self.db.identities_db+".domains dom")
        tables.add(self.db.identities_db+".uidentities up")

        filters.union_update(self.db.GetFiltersDomains())
        filters.add(closed_condition)
        filters.add("pup.uuid = up.uuid")
        filters.add("upd.domain_id = dom.id")
        filters.add("dom.name = " + domain_name)
        filters.add("dom.name = " + domain_name)
        filters.add("changed_on >= " + startdate)
        filters.add("changed_on < " + enddate)
        if len(filter_bots) > 0:
            filters.add(filter_bots)

        query = "select " + self.db._get_fields_query(fields)
        query = query + " from " + self.db._get_tables_query(tables)
        query = query + " where " + self.db._get_filters_query(filters)
        query = query + " GROUP BY up.identifier ORDER BY closed DESC, closers LIMIT " + str(limit)

        return self.db.ExecuteQuery(query)
开发者ID:jsmanrique,项目名称:GrimoireLib,代码行数:42,代码来源:its_metrics.py


注:本文中的vizgrimoire.ITS.ITS._get_closed_condition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。