def aggregations(self):
        """Get the single valued aggregations for current query
        with respect to the previous time interval."""

        prev_month_start = get_prev_month(self.end, self.query.interval_)
        self.query.since(prev_month_start)
        agg = super().aggregations()
        if agg is None:
            agg = 0  # None is because NaN in ES. Let's convert to 0
        return agg
예제 #2
0
    def aggregations(self):
        """
        Override parent method. Obtain list of the terms and their corresponding
        values using "terms" aggregations for the previous time period.

        :returns: a data frame containing terms and their corresponding values
        """

        prev_month_start = get_prev_month(self.end, self.query.interval_)
        self.query.since(prev_month_start)
        self.query.get_terms("author_name")
        return self.query.get_list(dataframe=True)
    def aggregations(self):
        """Get the aggregation value for BMI with respect to the previous
        time interval."""

        prev_month_start = get_prev_month(self.end,
                                          self.closed.query.interval_)
        self.closed.query.since(prev_month_start, field="closed_at")
        closed_agg = self.closed.aggregations()
        self.opened.query.since(prev_month_start)
        opened_agg = self.opened.aggregations()
        if opened_agg == 0:
            bmi = 1.0  # if no submitted issues/prs, bmi is at 100%
        else:
            bmi = closed_agg / opened_agg
        return bmi