Fixed median days showing 0 for imported applications (T177200). Also fixed it including apps that weren't closed, and now displays - if the partner has no closed, not imported, applications
@@ -74,10 +74,14 @@ class PartnersDetailView(DetailView):
context['unique_users_approved_or_sent'] = context['unique_users_approved'] + context['unique_users_sent']
+ application_end_states = [Application.APPROVED, Application.NOT_APPROVED, Application.SENT]
partner_app_time = Application.objects.filter(
- partner=partner).values_list('days_open', flat=True)
+ partner=partner, status__in=application_end_states).exclude(imported=True).values_list('days_open', flat=True)
+ if len(partner_app_time) > 0:
context['median_days'] = get_median(list(partner_app_time))
+ else:
+ context['median_days'] = "-"
context['app_distribution_data'] = get_application_status_data(
Application.objects.filter(partner=partner)
