diff --git a/main/models/user_profile.py b/main/models/user_profile.py index 03851c88c..d5bf7fe21 100644 --- a/main/models/user_profile.py +++ b/main/models/user_profile.py @@ -47,14 +47,6 @@ def twitter_clean(self): class Meta: app_label = 'main' -from utils.stathat_api import stathat_count - - -def stathat_user_signups(sender, instance, created, **kwargs): - if created: - stathat_count('formhub-signups') -post_save.connect(stathat_user_signups, sender=UserProfile) - def create_auth_token(sender, instance=None, created=False, **kwargs): if created: diff --git a/odk_logger/models/instance.py b/odk_logger/models/instance.py index cf6f007ae..30b228cc6 100644 --- a/odk_logger/models/instance.py +++ b/odk_logger/models/instance.py @@ -8,7 +8,6 @@ from odk_logger.xform_instance_parser import XFormInstanceParser, \ clean_and_parse_xml, get_uuid_from_xml from utils.model_tools import set_uuid -from utils.stathat_api import stathat_count from django.utils.translation import ugettext as _ from taggit.managers import TaggableManager @@ -185,11 +184,6 @@ def update_xform_submission_count_delete(sender, instance, **kwargs): dispatch_uid='update_xform_submission_count_delete') -def stathat_form_submission(sender, instance, created, **kwargs): - if created: - stathat_count('formhub-submissions') - - class InstanceHistory(models.Model): class Meta: app_label = 'odk_logger' diff --git a/odk_logger/models/xform.py b/odk_logger/models/xform.py index 65bdc29d9..ed581e6f1 100644 --- a/odk_logger/models/xform.py +++ b/odk_logger/models/xform.py @@ -15,7 +15,6 @@ from taggit.managers import TaggableManager from odk_logger.xform_instance_parser import XLSFormError -from utils.stathat_api import stathat_count from stats.tasks import stat_log from hashlib import md5 @@ -216,7 +215,6 @@ def public_forms(cls): def stats_forms_created(sender, instance, created, **kwargs): if created: - stathat_count('formhub-forms-created') stat_log.delay('formhub-forms-created', 1) post_save.connect(stats_forms_created, sender=XForm) diff --git a/staff/templates/stats.html b/staff/templates/stats.html deleted file mode 100644 index 184c57b54..000000000 --- a/staff/templates/stats.html +++ /dev/null @@ -1,19 +0,0 @@ -{% load i18n %} -
- - -

-

{% trans Submissions %}

- - -
-

{% trans Signups %}

- - -
- -

-
- diff --git a/utils/stathat.py b/utils/stathat.py deleted file mode 100644 index 55780f6c9..000000000 --- a/utils/stathat.py +++ /dev/null @@ -1,22 +0,0 @@ -import urllib -import urllib2 - -class StatHat: - - def http_post(self, path, data): - pdata = urllib.urlencode(data) - req = urllib2.Request('http://api.stathat.com' + path, pdata) - resp = urllib2.urlopen(req) - return resp.read() - - def post_value(self, user_key, stat_key, value): - return self.http_post('/v', {'key': stat_key, 'ukey': user_key, 'value': value}) - - def post_count(self, user_key, stat_key, count): - return self.http_post('/c', {'key': stat_key, 'ukey': user_key, 'count': count}) - - def ez_post_value(self, email, stat_name, value): - return self.http_post('/ez', {'email': email, 'stat': stat_name, 'value': value}) - - def ez_post_count(self, email, stat_name, count): - return self.http_post('/ez', {'email': email, 'stat': stat_name, 'count': count}) diff --git a/utils/stathat_api.py b/utils/stathat_api.py deleted file mode 100644 index 153ca853a..000000000 --- a/utils/stathat_api.py +++ /dev/null @@ -1,18 +0,0 @@ -from django.conf import settings -from stathat import StatHat -from urllib2 import HTTPError -from django.core.mail import mail_admins - - -def stathat_count(stat, count=1): - if hasattr(settings, 'STATHAT_EMAIL'): - stathat = StatHat() - - try: - result = stathat.ez_post_count(settings.STATHAT_EMAIL, stat, count) - except HTTPError as e: - mail_admins("StatHat API Error", e.message) - return False - else: - return result -