Exemplo n.º 1
0
    def import_project(self, project_id, options):
        data = self._client.get(
            "/board/{}".format(project_id),
            {
                "fields": "name,desc",
                "cards": "all",
                "card_fields": "closed,labels,idList,desc,due,name,pos,dateLastActivity,idChecklists,idMembers,url",
                "card_attachments": "true",
                "labels": "all",
                "labels_limit": "1000",
                "lists": "all",
                "list_fields": "closed,name,pos",
                "members": "none",
                "checklists": "all",
                "checklist_fields": "name",
                "organization": "true",
                "organization_fields": "logoHash",
            }
        )

        project = self._import_project_data(data, options)
        self._import_user_stories_data(data, project, options)
        self._cleanup(project, options)
        Timeline.objects.filter(project=project).delete()
        rebuild_timeline(None, None, project.id)
        return project
Exemplo n.º 2
0
    def handle(self, *args, **options):
        current_slug = options["current_slug"]
        new_slug = options["new_slug"]

        try:
            project = Project.objects.get(slug=current_slug)
        except Project.DoesNotExist:
            raise CommandError(
                "There is no project with the slug '{}'".format(current_slug))

        slug = slugify_uniquely(new_slug, Project)
        if slug != new_slug:
            raise CommandError(
                "Invalid new slug, maybe you can try with '{}'".format(slug))

        # Change slug
        self.stdout.write(
            self.style.SUCCESS("-> Change slug to '{}'.".format(slug)))
        project.slug = slug
        project.save()

        # Reset diff cache in history entries
        self.stdout.write(
            self.style.SUCCESS(
                "-> Reset value_diff cache for history entries."))
        HistoryEntry.objects.filter(project=project).update(
            values_diff_cache=None)

        # Regenerate timeline
        self.stdout.write(
            self.style.SUCCESS("-> Regenerate timeline entries."))
        rebuild_timeline(None, None, project.id)
Exemplo n.º 3
0
 def import_project(self, project_id, options):
     project = self._client.projects.find_by_id(project_id)
     Tina_project = self._import_project_data(project, options)
     self._import_user_stories_data(Tina_project, project, options)
     Timeline.objects.filter(project=Tina_project).delete()
     rebuild_timeline(None, None, Tina_project.id)
     return Tina_project
Exemplo n.º 4
0
 def import_project(self, project_id, options=None):
     self.resolve_user_bindings(options)
     project = self._import_project_data(project_id, options)
     self._import_epics_data(project_id, project, options)
     self._import_user_stories_data(project_id, project, options)
     self._cleanup(project, options)
     Timeline.objects.filter(project=project).delete()
     rebuild_timeline(None, None, project.id)
     recalc_reference_counter(project)
     return project
Exemplo n.º 5
0
 def import_project(self, project_full_name, options={"keep_external_reference": False, "template": "kanban", "type": "user_stories"}):
     repo = self._client.get('/repos/{}'.format(project_full_name))
     project = self._import_project_data(repo, options)
     if options.get('type', None) == "user_stories":
         self._import_user_stories_data(project, repo, options)
     elif options.get('type', None) == "issues":
         self._import_issues_data(project, repo, options)
     self._import_comments(project, repo, options)
     self._import_history(project, repo, options)
     Timeline.objects.filter(project=project).delete()
     rebuild_timeline(None, None, project.id)
     recalc_reference_counter(project)
     return project
Exemplo n.º 6
0
 def import_project(
     self,
     project_id,
     options={
         "template": "scrum",
         "users_bindings": {},
         "keep_external_reference": False
     }):
     (project,
      project_data) = self._import_project_data(project_id, options)
     self._import_epics_data(project_data, project, options)
     self._import_user_stories_data(project_data, project, options)
     Timeline.objects.filter(project=project).delete()
     rebuild_timeline(None, None, project.id)
     recalc_reference_counter(project)
Exemplo n.º 7
0
    def handle(self, *args, **options):
        if options["purge"] == True:
            Timeline.objects.all().delete()

        rebuild_timeline(options["initial_date"], options["final_date"],
                         options["project"])