예제 #1
0
 def get_context_data(self, **kwargs):
     context = super(HomeView, self).get_context_data(**kwargs)
     context['total_sprints'] = ProjectService.get_num_sprints_from_project(self.request.session.get('project_id', None))
     context['total_requeriments'] = ProjectService.get_num_requeriments_from_project(self.request.session.get('project_id', None))
     context['task_effort'] = SprintService.task_effort(self.request.session.get('project_id', None))
     context['storypoints_variation'] = SprintService.storypoint(self.request.session.get('project_id', None))
     context['project'] = ProjectService.get_project(self.request.session['project_id'])
     context['total_realized_storypoints'] = ArtifactService.total_realized_storyPoints(self.request.session.get('project_id', None))
     context['total_userstories'] = ProjectService.get_num_userstories_from_project(self.request.session.get('project_id', None))
     context['total_artifacts'] = ProjectService.get_num_artifacts_from_project(self.request.session.get('project_id', None))
     return context
예제 #2
0
    def get_context_data(self, **kwargs):
        context = super(ArtifactDocumentForm, self).get_context_data(**kwargs)
        project = ProjectService.get_project(self.request.session['project_id'])
        context['project']=project
        context['local_repository']=settings.REPOSITORY_DIR
        if self.request.is_secure():
            url = 'https://'+get_current_site(self.request).domain
        else:
            url = 'http://'+get_current_site(self.request).domain

        if 'userstory' in self.kwargs: #userstory
            userstory = UserStoryService.get_userstory(self.request.session['project_id'], self.kwargs['userstory'])
            context['artifacttype'] = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 3, 0)
            context['artifact'] = UserStoryService.get_artifacts(self.request.session['project_id'], userstory)
            context['page_title'] = _('UserStory Artifacts')
            context['url'] = url+'/userstory/'+str(userstory.id)+'/detail/artifact/'
            context['breadcrumbs'] = userstories_breadcrumbs(
                self.request.session.get('project_id'),
                self.kwargs.get('requeriment_id'),
                self.kwargs.get('sprint_id'),
                self.kwargs.get('userstory'),
                'Artifacts'
            )
        elif 'sprint_id' in self.kwargs:
            sprint = SprintService.get_sprint(self.request.session['project_id'], self.kwargs['sprint_id'])
            context['artifacttype'] = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 2, 0)
            context['artifact'] = SprintService.get_artifacts(self.request.session['project_id'], sprint)
            context['page_title'] = _('Sprint Artifacts')
            context['breadcrumbs'] = (
               {'link': reverse_lazy('main:home'), 'class': '', 'name': _('Home')},
               {'link': reverse_lazy('main:sprint'), 'class': '', 'name': _('Sprint')},
               {'link': reverse_lazy('main:sprint-details',kwargs={'sprint_id':sprint.id}), 'class': '', 'name': sprint},
               {'link': '#', 'class': '', 'name': _('Artifacts')},
            )
        elif 'requeriment_id' in self.kwargs:
            requeriment = RequerimentService.get_requeriment(self.request.session['project_id'], self.kwargs['requeriment_id'])
            context['artifacttype'] = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 1, 0)
            context['artifact'] = RequerimentService.get_artifacts(self.request.session['project_id'], requeriment)
            context['page_title'] = _('Requeriment Artifacts')
            context['breadcrumbs'] = (
                {'link': reverse_lazy('main:home'), 'class': '', 'name': _('Home')},
                {'link': reverse_lazy('main:requeriment'), 'class': '', 'name': _('Requeriment')},
                {'link': reverse_lazy('main:requeriment-details', kwargs={'pk': requeriment.id}), 'class': '',
                 'name': requeriment.code},
                {'link': '#', 'class': '', 'name': _('Artifacts')},
            )
        else:
            context['artifact'] = ProjectService.get_artifacts(self.request.session['project_id'])
            context['artifacttype'] = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 0, 0)
            context['page_title'] = _('Project Artifacts')
        return context
예제 #3
0
    def get_context_data(self, **kwargs):
        context = super(ArtifactTraceCodeView, self).get_context_data(**kwargs)
        project = ProjectService.get_project(self.request.session.get('project_id', None))
        Artifact.objects.filter(project=project,type__type=1).delete()
        sid = transaction.savepoint()

        artifactsTypes = ArtifactType.objects.filter(project=project, type=1,)
        repo = RepositoryFactory(project)
        repo.repository.pull()
        sf = SourceFinder(project, artifactsTypes)
        for artifact in sf.artifactList:
            try:
                if artifact['artifactType'].level == 0:
                    Artifact.objects.create(project=project, source=artifact['source'], line=artifact['line'], type=artifact['artifactType'])
                elif artifact['artifactType'].level == 1:
                    requeriment = Requeriment.objects.filter(project=project, code=artifact['code']).get()
                    Artifact.objects.create(project=project, source=artifact['source'], line=artifact['line'],
                                            type=artifact['artifactType'], requeriment=requeriment)
                elif artifact['artifactType'].level == 2:
                    sprint = Sprint.objects.filter(project=project, code=artifact['code']).get()
                    Artifact.objects.create(project=project, source=artifact['source'], line=artifact['line'],
                                            type=artifact['artifactType'], sprint=sprint)
                elif artifact['artifactType'].level == 3:
                    userstory = UserStory.objects.filter(project=project, code=artifact['code']).get()
                    Artifact.objects.create(project=project, source=artifact['source'], line=artifact['line'],
                                            type=artifact['artifactType'], userstory=userstory)
            except:
                context['erros']="erros: {} {}", artifact['source'], artifact['line']
        context['project'] = project
        return context
예제 #4
0
class ProjectDeleteView(SuccessMessageMixin, DeleteView):
    """
    #class:US006
    Delete Sprint
    """
    model = ProjectService.get_project_model()
    template_name = 'project/delete.html'
    fields = ('name', 'requester')

    def get_success_url(self):
        return reverse('main:project-list')

    def get_context_data(self, **kwargs):
        context = super(ProjectDeleteView, self).get_context_data()
        breadcrumbs = (
            {
                'link': reverse_lazy('main:home'),
                'class': '',
                'name': _('Home')
            },
            {
                'link': reverse_lazy('main:project-list'),
                'class': 'active',
                'name': _('Project')
            },
            {
                'link': '#',
                'class': 'active',
                'name': _('Update')
            },
        )
        return context
예제 #5
0
 def get_context_data(self, **kwargs):
     context = super(ActivityListView, self).get_context_data(**kwargs)
     project = ProjectService.get_project(self.request.session['project_id'])
     context['project'] = project
     context['open_myactivities'] = ArtifactService.get_activities(self.request.session['project_id'], True, self.request.user.id, True)
     context['open_otheractivities'] = ArtifactService.get_activities(self.request.session['project_id'], True, self.request.user.id, False)
     return context
예제 #6
0
 def form_valid(self, form, sprint_userstory_form):
     project = ProjectService.get_project(self.request.session.get('project_id'))
     form.instance.changed_by = self.request.user
     form.instance.project = project
     self.object = form.save()
     sprint_userstory_form.instance = self.object
     sprint_userstory_form.save()
     return HttpResponseRedirect(self.get_success_url())
예제 #7
0
 def get_context_data(self, **kwargs):
     context = super(RequerimentGraphView, self).get_context_data(**kwargs)
     requeriments = ProjectService.get_project_requeriments(self.request.session.get('project_id', None))
     context['requeriments']=requeriments
     context['breadcrumbs'] = requeriments_breadcrumbs(
         self.request.session['project_id'],
         self.kwargs.get('requeriment_id'),
         self.kwargs.get('sprint_id'),
         _('Graph'),
     )
     return context
예제 #8
0
    def get_context_data(self, **kwargs):
        context = super(ArtifactTraceBugTrackingConfirm, self).get_context_data(**kwargs)
        project = ProjectService.get_project(self.request.session.get('project_id', None))
        if self.request.is_secure():
            context['url']='https://'+get_current_site(self.request).domain+'/'+'artifact/'+str(project.id)+'/tracebugtracking/'
        else:
            context['url'] = 'http://' + get_current_site(
                self.request).domain + '/' + 'artifact/' + str(project.id) + '/tracebugtracking/'

        context['project'] = project
        return context
예제 #9
0
 def get_context_data(self, **kwargs):
     context = super(RequerimentGraphView, self).get_context_data(**kwargs)
     requeriments = ProjectService.get_project_requeriments(
         self.request.session.get('project_id', None))
     context['requeriments'] = requeriments
     context['breadcrumbs'] = requeriments_breadcrumbs(
         self.request.session['project_id'],
         self.kwargs.get('requeriment_id'),
         self.kwargs.get('sprint_id'),
         _('Graph'),
     )
     return context
예제 #10
0
    def get_context_data(self, **kwargs):
        context = super(ArtifactCodeConfirm, self).get_context_data(**kwargs)
        project = ProjectService.get_project(self.request.session.get('project_id', None))
        context['local_repository'] = settings.REPOSITORY_DIR
        if self.request.is_secure():
            context['url']='https://'+get_current_site(self.request).domain+'/'+'artifact/'+str(project.id)+'/tracecode/'
        else:
            context['url'] = 'http://' + get_current_site(
                self.request).domain + '/' + 'artifact/' + str(project.id) + '/tracecode/'

        context['project'] = project
        return context
예제 #11
0
 def form_valid(self, form):
     project = ProjectService.get_project(self.request.session['project_id'])
     form.instance.project = project
     if 'userstory' in self.kwargs:
         userstory = UserStoryService.get_userstory(self.request.session['project_id'], self.kwargs['userstory'])
         form.instance.userstory = userstory
     elif 'sprint_id' in self.kwargs:
         sprint = SprintService.get_sprint(self.request.session['project_id'], self.kwargs['sprint_id'])
         form.instance.sprint = sprint
     elif 'requeriment_id' in self.kwargs:
         requeriment = RequerimentService.get_requeriment(self.request.session['project_id'], self.kwargs['requeriment_id'])
         form.instance.requeriment = requeriment
     return super(ArtifactDocumentForm, self).form_valid(form)
예제 #12
0
    def form_valid(self, form, sprint_userstory_form):
        project = ProjectService.get_project(self.request.session['project_id'])
        form.instance.changed_by = self.request.user
        form.instance.project = project
        self.object = form.save()
        sprint_userstory_form.instance = self.object
        spus = sprint_userstory_form.save()

        #save new redmine issue related to userstory and artifact related
        if project.issueOnInsertUserStory:
            ArtifactService.add_redmine_activity(project,spus, self.request, self.object)


        return HttpResponseRedirect(self.get_success_url())
예제 #13
0
 def get_context_data(self, **kwargs):
     context = super(HomeView, self).get_context_data(**kwargs)
     context['total_sprints'] = ProjectService.get_num_sprints_from_project(
         self.request.session.get('project_id', None))
     context[
         'total_requeriments'] = ProjectService.get_num_requeriments_from_project(
             self.request.session.get('project_id', None))
     context['task_effort'] = SprintService.task_effort(
         self.request.session.get('project_id', None))
     context['storypoints_variation'] = SprintService.storypoint(
         self.request.session.get('project_id', None))
     context['project'] = ProjectService.get_project(
         self.request.session['project_id'])
     context[
         'total_realized_storypoints'] = ArtifactService.total_realized_storyPoints(
             self.request.session.get('project_id', None))
     context[
         'total_userstories'] = ProjectService.get_num_userstories_from_project(
             self.request.session.get('project_id', None))
     context[
         'total_artifacts'] = ProjectService.get_num_artifacts_from_project(
             self.request.session.get('project_id', None))
     return context
예제 #14
0
 def get_form(self, *args, **kwargs):
     form = super(ActivityUpdateFormView, self).get_form(*args, **kwargs)
     if 'userstory' in self.kwargs:
         form.fields['type'].queryset = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 3,
                                                                              2)
     elif 'sprint_id' in self.kwargs and 'requeriment_id' not in self.kwargs:
         form.fields['type'].queryset = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 2,
                                                                              2)
     elif 'requeriment_id' in self.kwargs:
         form.fields['type'].queryset = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 1,
                                                                              2)
     else:
         form.fields['type'].queryset = ArtifactTypeService.get_artifactstype(self.request.session['project_id'], 0,
                                                                              2)
     if self.request.user.is_superuser:
         form.fields['user'].queryset = ProjectService.get_users_from_project(self.request.session['project_id'])
     return form
예제 #15
0
    def get_context_data(self, **kwargs):
        context = super(ArtifactTraceBugTrackingView, self).get_context_data(**kwargs)

        project = ProjectService.get_project(self.request.session.get('project_id', None))


        if project.versionAsSprint:
            context['sprintImportLogs'] = ArtifactService.get_sprints_from_bugtracking(project)
            context['artifactImportLogs'] = ArtifactService.get_bugtrack_activities(project, True)
        else:
            context['artifactImportLogs'] = ArtifactService.get_bugtrack_activities(project)

        if project.issueTypesAsUserStory:
            context['userStoryImportLogs'] = ArtifactService.get_userstories_from_bugtracking(project)
            context['sprintUsertory'] = ArtifactService.sprint_to_userstory(project)

        context['project'] = project
        return context
예제 #16
0
class ProjectView(ModelList):
    """
    #class:US004
    #class:US003
    Projects Choose Page.
    """
    model = ProjectService.get_project_model()
    list_display = ('name', )
    page_title = _('Choose a project:')
    action_template = 'project/choose_action.html'

    def dispatch(self, request, *args, **kwargs):
        if 'project_id' in self.kwargs:
            self.request.session['project_id'] = self.kwargs['project_id']
            return redirect(reverse('main:home'))
        else:
            return super(ProjectView, self).dispatch(request, *args, **kwargs)

    def get_queryset(self):
        user = self.request.user
        return ProjectService.get_user_projects(user)
예제 #17
0
class ProjectListView(ProjectView):
    """
    #class:US002
    List of projects for options for choosing, adding, changing, or deleting
    """
    model = ProjectService.get_project_model()
    page_title = 'Projects'
    list_display = ('name', 'requester', 'points_type')
    action_template = "project/action.html"
    top_bar = 'project/top_bar.html'
    breadcrumbs = (
        {
            'link': reverse_lazy('main:home'),
            'class': '',
            'name': _('Home')
        },
        {
            'link': reverse_lazy('main:project-list'),
            'class': 'active',
            'name': _('Project')
        },
    )
예제 #18
0
 def form_valid(self, form):
     project = ProjectService.get_project(
         self.request.session['project_id'])
     #form.instance.changed_by = self.request.user
     form.instance.project = project
     return super(ArtifactTypeAddFormView, self).form_valid(form)
예제 #19
0
 def form_valid(self, form):
     project = ProjectService.get_project(
         self.request.session['project_id'])
     form.instance.changed_by = self.request.user
     form.instance.project = project
     return super(RequerimentUpdateFormView, self).form_valid(form)
예제 #20
0
class ProjectAddFormView(AddFormView):
    """
    #class:US002
    Add project form
    """
    model = ProjectService.get_project_model()
    form_class = ProjectForm
    page_title = _('Project')
    head_template = 'project/head.html'
    success_message = _('Project was created successfully')
    tabs = (
        {
            "title":
            "Project",
            "id":
            "project",
            "class":
            "active",
            "fields":
            ("name", "requester", "description", "points_type", "total_points")
        },
        {
            "title": "Repository",
            "id": "repository",
            "fields": ("repository_type", "repository_url")
        },
        {
            "title":
            "Bug Tracking Tool",
            "id":
            "tracking",
            "fields":
            ('tracking_tool_type', 'tracking_tool_url', 'tracking_tool_user',
             'tracking_tool_password', 'tracking_tool_project_id',
             'versionAsSprint', 'issueTypesAsUserStory', 'issueStatusClosed',
             'issueOnInsertUserStory')
        },
        {
            "title":
            "Points",
            "id":
            "sp",
            "fields": (
                'tracking_sp_planned_variable',
                'tracking_sp_realized_variable',
            )
        },
        {
            "title":
            "Business Value",
            "id":
            "bv",
            "fields": (
                'tracking_bv_planned_variable',
                'tracking_bv_realized_variable',
            )
        },
        {
            "title": "Users",
            "id": "user",
            "fields": ("user", )
        },
    )
    breadcrumbs = (
        {
            'link': reverse_lazy('main:home'),
            'class': '',
            'name': _('Home')
        },
        {
            'link': reverse_lazy('main:project-list'),
            'class': 'active',
            'name': _('Project')
        },
        {
            'link': '#',
            'class': 'active',
            'name': _('Add')
        },
    )

    def get_success_url(self):
        return reverse('main:project-list')
예제 #21
0
 def get_queryset(self):
     user = self.request.user
     return ProjectService.get_user_projects(user)
예제 #22
0
 def form_valid(self, form):
     project = ProjectService.get_project(self.request.session['project_id'])
     form.instance.changed_by = self.request.user
     form.instance.project = project
     return super(RequerimentAddFormView, self).form_valid(form)
예제 #23
0
 def form_valid(self, form):
     project = ProjectService.get_project(
         self.request.session['project_id'])
     form.instance.project = project
     return super(SprintUpdateFormView, self).form_valid(form)
예제 #24
0
 def form_valid(self, form):
     project = ProjectService.get_project(self.request.session['project_id'])
     #form.instance.changed_by = self.request.user
     form.instance.project = project
     return super(ArtifactTypeUpdateFormView, self).form_valid(form)
예제 #25
0
 def get_queryset(self):
     user = self.request.user
     return ProjectService.get_user_projects(user)
예제 #26
0
 def form_valid(self, form):
     project = ProjectService.get_project(self.request.session['project_id'])
     form.instance.project = project
     return super(SprintUpdateFormView, self).form_valid(form)