Exemplo n.º 1
0
 def add_milestone(self, user, name=None, milestone_id=None):
     from models.milestone import Milestone
     target = self.target
     if name:
         ms = Milestone.get_by_project(target, name=name)
         if not ms:
             ms = Milestone.create_by_project(self.target, name, user)
     elif milestone_id:
         ms = Milestone.get_by(milestone_id)
     else:
         return None
     ims = IssueMilestone.get_by_issue(self)
     if ims:
         ims.milestone_id = ms.id
         ims.save()
     else:
         ims = IssueMilestone.create_by_issue(self, ms, user)
Exemplo n.º 2
0
from models.label import Label
from models.milestone import Milestone
from models.issue import Issue
from templates import simple
import sys

project_id = sys.argv[1]

lbl_result = {}
mls_result = {}

for label in simple.labels:
    lbl_result[label['name']] = Label(project_id).create(label)

for milestone in simple.milestones:
    mls_result[milestone['title']] = Milestone(project_id).create(milestone)
    for task in simple.issues[milestone['title']]:
        print(mls_result[milestone['title']])
        task['milestone_id'] = mls_result[milestone['title']]['id']
        print(Issue(project_id).create(task))
Exemplo n.º 3
0
 def milestone_percentage(self):
     from models.milestone import Milestone
     m_id = self.milestone_id
     m = Milestone.get_by(m_id) if m_id else None
     return m.percentage if m else 0
Exemplo n.º 4
0
 def milestone_name(self):
     from models.milestone import Milestone
     m_id = self.milestone_id
     m = Milestone.get_by(m_id) if m_id else None
     return m.name if m else ''