コード例 #1
0
    def get_queryset(self):
        self.maintplan_name = self.kwargs['maintplan_name']
        maintplan = get_object_or_404(MaintenancePlan,
                                      name=self.maintplan_name)
        self.release_name = self.kwargs['release_name']
        release = get_object_or_404(Release,
                                    plan=maintplan,
                                    name=self.release_name)

        self.milestone_name = self.kwargs['milestone_name']
        milestone = get_object_or_404(Milestone,
                                      release=release,
                                      name=self.milestone_name)

        if 'upstream_status' in self.request.GET.keys():
            self.upstream_status = self.request.GET['upstream_status']
        else:
            self.upstream_status = 'All'

        if 'maintainer_name' in self.request.GET.keys():
            self.maintainer_name = self.request.GET['maintainer_name']
        else:
            self.maintainer_name = 'All'

        if 'search' in self.request.GET.keys():
            self.search = self.request.GET['search']

            # only allow one type of filter search or upstream_status/maintainer
            self.upstream_status = 'All'
            self.maintainer_name = 'All'
        else:
            self.search = ''

        _check_url_params(self.upstream_status, self.maintainer_name)

        self.milestone_statistics = _get_milestone_statistics(milestone)

        self.recipe_maintainer_history = {}
        for maintplanlayer in maintplan.maintenanceplanlayerbranch_set.all():
            layerbranch = maintplanlayer.layerbranch
            self.recipe_maintainer_history[
                layerbranch.id] = RecipeMaintainerHistory.get_by_end_date(
                    layerbranch, milestone.end_date)

        recipe_list = _get_recipe_list(milestone)
        self.recipe_list_count = len(recipe_list)

        return recipe_list
コード例 #2
0
ファイル: views.py プロジェクト: anelliot/layerindex-web
def _get_recipe_upgrade_detail(maintplan, recipe_upgrade):
    release_name = ''
    milestone_name = ''
    recipe_maintainer_history = None

    release = Release.get_by_date(maintplan, recipe_upgrade.commit_date)
    if release:
        release_name = release.name
        milestone = Milestone.get_by_release_and_date(
            release, recipe_upgrade.commit_date)
        if milestone:
            milestone_name = milestone.name
            recipe_maintainer_history = RecipeMaintainerHistory.get_by_end_date(
                recipe_upgrade.recipesymbol.layerbranch, milestone.end_date)

    is_recipe_maintainer = False
    maintainer_name = ''
    if not recipe_upgrade.maintainer is None:
        maintainer_name = recipe_upgrade.maintainer.name

        if not recipe_maintainer_history is None and \
            RecipeMaintainer.objects.filter(maintainer__name
            = maintainer_name, history = recipe_maintainer_history) \
            .count() > 0:
            is_recipe_maintainer = True

    commit_date = recipe_upgrade.commit_date.date().isoformat()
    commit = recipe_upgrade.sha1[:10]
    commit_url = recipe_upgrade.recipesymbol.layerbranch.commit_url(
        recipe_upgrade.sha1)

    rud = RecipeUpgradeDetail(recipe_upgrade.title, recipe_upgrade.version, \
            maintplan.name, release_name, milestone_name, commit_date, maintainer_name, \
            is_recipe_maintainer, commit, commit_url, recipe_upgrade.upgrade_type, \
            recipe_upgrade.group)

    return rud
コード例 #3
0
    def get_queryset(self):
        maintainer_list = []
        self.maintainer_count = 0

        self.maintplan_name = self.kwargs['maintplan_name']
        maintplan = get_object_or_404(MaintenancePlan,
                                      name=self.maintplan_name)
        self.release_name = self.kwargs['release_name']
        release = get_object_or_404(Release,
                                    plan=maintplan,
                                    name=self.release_name)
        self.milestone_name = self.kwargs['milestone_name']
        milestone = get_object_or_404(Milestone,
                                      release=release,
                                      name=self.milestone_name)

        if "All" in milestone.name:
            intervals = milestone.get_milestone_intervals(release)
            interval_type = 'Milestone'
        else:
            intervals = milestone.get_week_intervals()
            interval_type = 'Week'

        self.milestone_statistics = _get_milestone_statistics(milestone)

        self.maintainer_count = 0
        for maintplanlayer in maintplan.maintenanceplanlayerbranch_set.all():
            layerbranch = maintplanlayer.layerbranch

            recipe_maintainer_history = RecipeMaintainerHistory.get_by_end_date(
                layerbranch, milestone.end_date)

            if recipe_maintainer_history:
                for rm in RecipeMaintainer.objects.filter(
                        history=recipe_maintainer_history).values(
                            'maintainer__name').distinct().order_by(
                                'maintainer__name'):
                    maintainer_list.append(
                        MaintainerList(rm['maintainer__name']))

                self.maintainer_count += len(maintainer_list)

        self.intervals = sorted(intervals.keys())
        current_date = date.today()
        for ml in maintainer_list:
            milestone_statistics = _get_milestone_statistics(
                milestone, ml.name)
            ml.recipes_all = milestone_statistics['all']
            ml.recipes_up_to_date = (''
                                     if milestone_statistics['up_to_date'] == 0
                                     else milestone_statistics['up_to_date'])
            ml.recipes_not_updated = ('' if milestone_statistics['not_updated']
                                      == 0 else
                                      milestone_statistics['not_updated'])
            ml.recipes_cant_be_updated = (
                '' if milestone_statistics['cant_be_updated'] == 0 else
                milestone_statistics['cant_be_updated'])
            ml.recipes_unknown = ('' if milestone_statistics['unknown'] == 0
                                  else milestone_statistics['unknown'])
            ml.percentage_done = milestone_statistics['percentage'] + '%'

            ml.interval_statistics = []
            self.current_interval = -1
            for idx, i in enumerate(sorted(intervals.keys())):
                start_date = intervals[i]['start_date']
                end_date = intervals[i]['end_date']

                if current_date >= start_date and current_date <= end_date:
                    self.current_interval = idx

                number = RecipeUpgrade.objects.filter(
                    maintainer__name=ml.name,
                    commit_date__gte=start_date,
                    commit_date__lte=end_date).count()
                ml.interval_statistics.append('' if number == 0 else number)

        # To add Wk prefix after get statics to avoid sorting problems
        if interval_type == 'Week':
            self.intervals = ['Wk' + str(i) for i in self.intervals]

        return maintainer_list