示例#1
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
示例#2
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
示例#3
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())
示例#4
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
示例#5
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
示例#6
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
示例#7
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)
示例#8
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
示例#9
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())
示例#10
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
示例#11
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
示例#12
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)
示例#13
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)
示例#14
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)
示例#15
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)
示例#16
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)
示例#17
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)