

@property
def rows(self):
    rows = []
    locations = SQLLocation.objects.filter(parent__location_id=self.config['location_id'])
    dg = []
    for date in list(rrule.rrule(rrule.MONTHLY, dtstart=self.config['startdate'], until=self.config['enddate'])):
        dg.extend(DeliveryGroups().delivering(locations, date.month))
    for child in dg:
        group_summary = GroupSummary.objects.filter(org_summary__date__lte=self.config['startdate'], org_summary__location_id=child.location_id, title=SupplyPointStatusTypes.DELIVERY_FACILITY, total=1).exists()
        if (not group_summary):
            continue
        latest = latest_status_or_none(child.location_id, SupplyPointStatusTypes.DELIVERY_FACILITY, self.config['startdate'], self.config['enddate'])
        status_name = (latest.name if latest else '')
        status_date = (latest.status_date.strftime('%d-%m-%Y') if latest else 'None')
        url = make_url(FacilityDetailsReport, self.config['domain'], '?location_id=%s&filter_by_program=%s&datespan_type=%s&datespan_first=%s&datespan_second=%s', (child.location_id, self.config['program'], self.config['datespan_type'], self.config['datespan_first'], self.config['datespan_second']))
        cycle_lead_time = get_this_lead_time(child.location_id, self.config['startdate'], self.config['enddate'])
        avg_lead_time = get_avg_lead_time(child.location_id, self.config['startdate'], self.config['enddate'])
        rows.append([child.site_code, link_format(child.name, url), status_name, status_date, cycle_lead_time, avg_lead_time])
    return rows

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