Skip to content

Commit

Permalink
Merge pull request #6494 from OCHA-DAP/dev
Browse files Browse the repository at this point in the history
dev to prod
  • Loading branch information
danmihaila authored Dec 3, 2024
2 parents 03b092b + 0931cd8 commit 41b401d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
18 changes: 18 additions & 0 deletions ckanext-hdx_org_group/ckanext/hdx_org_group/helpers/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,21 @@ def __init__(self, org_name, org_type):
'cd2': org_type
}
}

class OrganizationStatsDownloadAnalyticsSender(AbstractAnalyticsSender):

def __init__(self, org_name, org_id):
super(OrganizationStatsDownloadAnalyticsSender, self).__init__()
event_name = 'org stats download'
self.analytics_dict = {
'event_name': event_name,
'mixpanel_meta': {
'org name': org_name,
'org id': org_id
},
'ga_meta': {
'ec': 'organization', # event category
'ea': event_name, # event action
'el': org_name, # event label
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

from flask import Blueprint
from six.moves.urllib.parse import urlencode
from ckan.types import Context

import ckan.lib.plugins as lib_plugins
import ckan.model as model
import ckan.plugins.toolkit as tk
import ckanext.hdx_org_group.helpers.analytics as org_analytics
import ckanext.hdx_org_group.helpers.org_meta_dao as org_meta_dao
import ckanext.hdx_org_group.helpers.organization_helper as helper
import ckanext.hdx_org_group.helpers.static_lists as static_lists
import ckanext.hdx_theme.helpers.helpers as hdx_helpers
from ckan.types import Context
from ckan.views.group import CreateGroupView, EditGroupView, _get_group_template
from ckanext.hdx_org_group.controller_logic.organization_read_logic import OrgReadLogic
from ckanext.hdx_org_group.controller_logic.organization_stats_logic import (
Expand Down Expand Up @@ -390,13 +392,16 @@ def download_organization_stats(id):
try:
org_dict = get_action('organization_show')(context, {'id': id})
output = helper.hdx_generate_organization_stats(org_dict)
org_analytics.OrganizationStatsDownloadAnalyticsSender(org_dict.get('name', ''), org_dict.get('id', '')) \
.send_to_queue()
return output

except NotFound:
return abort(404, _('Organization not found'))
except NotAuthorized:
return abort(404, _('Organization not found'))
except Exception as e:
log.error(e)
return abort(404, _('Something went wrong, please contact us'))


Expand Down
2 changes: 1 addition & 1 deletion ckanext-hdx_theme/ckanext/hdx_theme/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
hdx_version = 'v1.85.6'
hdx_version = 'v1.85.7'

0 comments on commit 41b401d

Please sign in to comment.