Commit 360202f1 authored by Elger Jonker's avatar Elger Jonker

fix missing graphs in organization reports with complex names


Former-commit-id: e468e56e
parent 0784ba74
......@@ -254,7 +254,7 @@ const report_mixin = {
},
vulnerability_timeline_for_organization: function(organization_id){
fetch('/data/organization_vulnerability_timeline/' + organization_id)
fetch('/data/organization_vulnerability_timeline/' + organization_id + '/' + this.category + '/' + this.country)
.then(response => response.json()).then(data => {
let labels = Array();
......
......@@ -54,10 +54,10 @@ urlpatterns = [
path('data/organization_vulnerability_timeline/<oid:organization_id>', views.organization_vulnerability_timeline),
path('data/organization_vulnerability_timeline/<oid:organization_id>/<slug:organization_type>/<c:country>',
views.organization_vulnerability_timeline),
path('data/organization_vulnerability_timeline/<slug:organization_name>/<slug:organization_type>/<c:country>',
path('data/organization_vulnerability_timeline/<str:organization_name>/<slug:organization_type>/<c:country>',
views.organization_vulnerability_timeline_via_name),
path(
'data/organization_vulnerability_timeline/<slug:organization_name>/',
'data/organization_vulnerability_timeline/<str:organization_name>/',
views.organization_vulnerability_timeline_via_name),
path('data/report/<c:country>/<slug:organization_type>/<str:organization_name>/<w:weeks_back>',
views.organization_report),
......
......@@ -935,20 +935,24 @@ def organization_vulnerability_timeline(request, organization_id: int, organizat
def organization_vulnerability_timeline_via_name(request, organization_name: str,
organization_type: str = "", country: str = ""):
if not organization_type or country:
log.debug("Country: %s Category: %s Name: %s" % (country, organization_type, organization_name))
if not organization_type or not country:
# getting defaults
data = Configuration.objects.all().filter(
is_displayed=True,
is_the_default_option=True
).order_by('display_order').values('country', 'organization_type__name').first()
).order_by('display_order').values('country', 'organization_type').first()
country = data['country']
category = data['organization_type__name']
category = data['organization_type']
else:
country = get_country(country)
category = get_organization_type(organization_type)
country = get_country(code=country)
category = get_organization_type(name=organization_type)
log.debug("Country: %s Category: %s Name: %s" % (country, category, organization_name))
organization = Organization.objects.all().filter(country=country, type__name=category,
organization = Organization.objects.all().filter(country=country, type=category,
name=organization_name,
is_dead=False).first()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment