Sha256: eb11c373744f6d93cb3ad07c0025be9d12c354e9dfae9ce170a666ba49ee3ada

Contents?: true

Size: 770 Bytes

Versions: 4

Compression:

Stored size: 770 Bytes

Contents

import dbhelper
from trac.ticket.default_workflow import get_workflow_config
from sets import Set

def status_variables(statuses):
    return ', '.join(['$'+i.upper().replace("_","").replace(" ","") for i in list(statuses)])

def get_statuses(com):
    config = com.config
    stats = get_statuses_from_workflow(config)
    status_sql = """
    SELECT DISTINCT status FROM ticket WHERE status <> '' ;
    """
    stats |= Set(dbhelper.get_column_as_list(com, status_sql))
    stats.difference_update(['', None])
    return stats

def get_statuses_from_workflow(config):
    wf = get_workflow_config(config)
    x = Set()
    for key, value in wf.items():
        x.add(value['newstate'])
        x |= Set(value['oldstates'])
    x.difference_update([u'*'])
    return x

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
keithsalisbury-subtrac-0.1.1 lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/statuses.py
keithsalisbury-subtrac-0.1.2 lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/statuses.py
keithsalisbury-subtrac-0.1.3 lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/statuses.py
keithsalisbury-subtrac-0.1.4 lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/statuses.py