Example #1
0
import datetime
from taskmaster.db import task_model, org_model, queue_model, tags_model
from use_cases import PROJECTS

org = {'name': ''}
queue = {'name': ''}
task = {'name': ''}

try:
    for project in PROJECTS:
        org = org_model.create({
            'name': project['name'],
        })

        for queue_definition in project['queues']:
            queue = queue_model.create({
                'name': queue_definition['name'],
                'org': org['id'],
            })

            for task_id in queue_definition['tasks']:
                task = project['tasks'][task_id]

                task_obj = {
                    "name": task['name'],
                    "org": org['id'],
                    "tags": ','.join(project['tags'].get(task['name'], [])),
                    "status": task.get('status', "Not Started"),
                    "assignee": "",
                    "created_date": datetime.datetime.now().strftime("%Y-%m-%d"),
                    "queue": queue['id'],
Example #2
0
#
# ORGS
#
orgnames = []
for key in db.keys('org>*'):
    try:
        # Check it isn't already converted
        int(key, 16)
        continue
    except ValueError:
        orgnames.append(key[len('org>'):])

for orgname in orgnames:
    org = org_model.create({
        'name': orgname,
    })

    # Add users
    org_member_emails = db.smembers('org>%s' % orgname)
    for email in org_member_emails:
        user_id = user_model.id_from('email', email)
        if user_id:
            org_model.add_user(org['id'], user_id, level='admin')

    # Add queues
    org_queue_names = db.zrange('org-queues2>%s' % orgname, 0, -1)
    for queue_name in org_queue_names:
        try:
            # Check it isn't already converted
            int(queue_name, 16)
Example #3
0
def create_org():
    org = org_model.create({
        'owner': g.user,
        'name': request.form['name'],
    })
    return Response(json.dumps(org), status=201, content_type='application/json')
Example #4
0
import datetime
from taskmaster.db import task_model, org_model, queue_model, tags_model
from use_cases import PROJECTS

org = {'name': ''}
queue = {'name': ''}
task = {'name': ''}

try:
    for project in PROJECTS:
        org = org_model.create({
            'name': project['name'],
        })

        for queue_definition in project['queues']:
            queue = queue_model.create({
                'name': queue_definition['name'],
                'org': org['id'],
            })

            for task_id in queue_definition['tasks']:
                task = project['tasks'][task_id]

                task_obj = {
                    "name": task['name'],
                    "org": org['id'],
                    "tags": ','.join(project['tags'].get(task['name'], [])),
                    "status": task.get('status', "Not Started"),
                    "assignee": "",
                    "created_date":
                    datetime.datetime.now().strftime("%Y-%m-%d"),
#
# ORGS
#
orgnames = []
for key in db.keys('org>*'):
    try:
        # Check it isn't already converted
        int(key, 16)
        continue
    except ValueError:
        orgnames.append(key[len('org>'):])

for orgname in orgnames:
    org = org_model.create({
        'name': orgname,
    })

    # Add users
    org_member_emails = db.smembers('org>%s' % orgname)
    for email in org_member_emails:
        user_id = user_model.id_from('email', email)
        if user_id:
            org_model.add_user(org['id'], user_id, level='admin')

    # Add queues
    org_queue_names = db.zrange('org-queues2>%s' % orgname, 0, -1)
    for queue_name in org_queue_names:
        try:
            # Check it isn't already converted
            int(queue_name, 16)