Пример #1
0
    def problems(self, cmdline, db, opsys, release):
        """
        Get hot/long-term problem statistics
        """

        release_ids = get_release_ids(db, opsys, release)

        num_days = 7
        if cmdline.last:
            num_days = int(cmdline.last)

        since = datetime.datetime.now() - datetime.timedelta(days=num_days)

        hot = query_hot_problems(db,
                                 release_ids,
                                 history=self.history_type,
                                 last_date=since)

        if not cmdline.include_low_quality:
            hot = [x for x in hot if x.quality >= 0]
        hot = [p for p in hot if p.type in self.ptypes]

        out = ""
        if hot:
            out += "Hot problems:\n\n"
            out += self._render_problems(hot, cmdline.count, release_ids)
            out += "\n"
            if webfaf_installed():
                out += "URL: "
                out += reverse("problems.dashboard")
                out += "\n\n"

        lt = query_longterm_problems(db,
                                     release_ids,
                                     history=self.history_type)
        if not cmdline.include_low_quality:
            lt = [x for x in lt if x.quality >= 0]
        lt = [p for p in lt if p.type in self.ptypes]

        if lt:
            out += "Long-term problems:\n\n"
            out += self._render_problems(lt, cmdline.count, release_ids)
            out += "\n\n"

        return out
Пример #2
0
Файл: stats.py Проект: trams/faf
    def problems(self, cmdline, db, opsys, release):
        """
        Get hot/long-term problem statistics
        """

        release_ids = get_release_ids(db, opsys, release)

        num_days = 7
        if cmdline.last:
            num_days = int(cmdline.last)

        since = datetime.datetime.now() - datetime.timedelta(days=num_days)

        hot = query_hot_problems(db, release_ids, history=self.history_type,
                                 last_date=since)

        if not cmdline.include_low_quality:
            hot = filter(lambda x: x.quality >= 0, hot)

        out = ""
        if hot:
            out += "Hot problems:\n\n"
            out += self._render_problems(hot, cmdline.count, release_ids)
            out += "\n"
            if webfaf_installed():
                out += "URL: "
                out += reverse("webfaf.problems.views.hot")
                out += "\n\n"

        lt = query_longterm_problems(db, release_ids, history=self.history_type)
        if not cmdline.include_low_quality:
            lt = filter(lambda x: x.quality >= 0, lt)

        if lt:
            out += "Long-term problems:\n\n"
            out += self._render_problems(lt, cmdline.count, release_ids)
            out += "\n"
            if webfaf_installed():
                out += "URL: "
                out += reverse("webfaf.problems.views.longterm")
                out += "\n\n"

        return out
Пример #3
0
    def problems(self, cmdline, db, opsys, release):
        """
        Get hot/long-term problem statistics
        """

        release_ids = get_release_ids(db, opsys, release)

        num_days = 7
        if cmdline.last:
            num_days = int(cmdline.last)

        since = datetime.datetime.now() - datetime.timedelta(days=num_days)

        hot = query_hot_problems(db, release_ids, history=self.history_type,
                                 last_date=since)

        if not cmdline.include_low_quality:
            hot = [x for x in hot if x.quality >= 0]
        hot = [p for p in hot if p.type in self.ptypes]

        out = ""
        if hot:
            out += "Hot problems:\n\n"
            out += self._render_problems(hot, cmdline.count, release_ids)
            out += "\n"
            if webfaf_installed():
                out += "URL: "
                out += reverse("problems.dashboard")
                out += "\n\n"

        lt = query_longterm_problems(db, release_ids, history=self.history_type)
        if not cmdline.include_low_quality:
            lt = [x for x in lt if x.quality >= 0]
        lt = [p for p in lt if p.type in self.ptypes]

        if lt:
            out += "Long-term problems:\n\n"
            out += self._render_problems(lt, cmdline.count, release_ids)
            out += "\n\n"

        return out
Пример #4
0
def longterm(request, *args, **kwargs):
    db = pyfaf.storage.getDatabase()
    params = dict(request.REQUEST)
    params.update(kwargs)
    form = OsAssociateComponentFilterForm(db, params)

    ids = (r[0] for r in form.get_release_selection())

    problems = query_longterm_problems(db,
        flatten(ids),
        form.get_component_selection())

    if "application/json" in request.META.get("HTTP_ACCEPT"):
        return HttpResponse(json.dumps(problems, cls=WebfafJSONEncoder),
                            status=200, mimetype="application/json")
    else:
        problems = paginate(problems, request)
        forward = {'problems': problems,
                   'form': form}

        return render_to_response('problems/longterm.html',
                                  forward,
                                  context_instance=RequestContext(request))