

@property
def rows(self):
    locations = SQLLocation.objects.filter(parent__location_id=self.config['location_id'])
    rows = []
    for loc in locations:
        try:
            org_summary = OrganizationSummary.objects.filter(location_id=loc.location_id, date__range=(self.config['startdate'], self.config['enddate'])).aggregate(average_lead_time_in_days=Avg('average_lead_time_in_days'))
        except OrganizationSummary.DoesNotExist:
            continue
        avg_lead_time = org_summary['average_lead_time_in_days']
        if avg_lead_time:
            avg_lead_time = ('%.1f' % avg_lead_time)
        else:
            avg_lead_time = 'None'
        url = make_url(DeliveryReport, self.config['domain'], '?location_id=%s&filter_by_program=%s&datespan_type=%s&datespan_first=%s&datespan_second=%s', (loc.location_id, self.config['program'], self.config['datespan_type'], self.config['datespan_first'], self.config['datespan_second']))
        rows.append([link_format(loc.name, url), avg_lead_time])
    return rows

dataset/ETHPy150Open dimagi/commcare-hq/custom/ilsgateway/tanzania/reports/delivery.py LeadTimeHistory.rows/original