From cdecd29d22944b9732a19c14450859cd6d384971 Mon Sep 17 00:00:00 2001 From: Dickson Ukang'a Date: Thu, 27 Apr 2017 18:48:52 +0300 Subject: [PATCH] use num_of_submissions field to prevent a recount --- onadata/apps/logger/models/xform.py | 6 +----- onadata/apps/main/templates/profile.html | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/onadata/apps/logger/models/xform.py b/onadata/apps/logger/models/xform.py index 05e58a5d56..8d147ba203 100644 --- a/onadata/apps/logger/models/xform.py +++ b/onadata/apps/logger/models/xform.py @@ -881,11 +881,7 @@ def hash(self): @property def can_be_replaced(self): - if hasattr(self.submission_count, '__call__'): - num_submissions = self.submission_count() - else: - num_submissions = self.submission_count - return num_submissions == 0 + return self.num_of_submissions == 0 @classmethod def public_forms(cls): diff --git a/onadata/apps/main/templates/profile.html b/onadata/apps/main/templates/profile.html index 1b737f4545..7fb4b565c8 100644 --- a/onadata/apps/main/templates/profile.html +++ b/onadata/apps/main/templates/profile.html @@ -91,7 +91,7 @@

{% blocktrans %}Shared Forms & Public Data ({{ num_forms }}){ {% if form.shared_data %} - {% if form.submission_count %} + {% if form.num_of_submissions %}