Self-heal statistics results model
Happens when multiple results are created using the same slug value. Forum topic 1404. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -158,6 +158,11 @@ class Statistic(object):
|
||||
return StatisticResult.objects.get(slug=self.slug)
|
||||
except StatisticResult.DoesNotExist:
|
||||
return StatisticResult.objects.none()
|
||||
except StatisticResult.MultipleObjectsReturned:
|
||||
# This should not happen. Self-heal by deleting the duplicate
|
||||
# results.
|
||||
StatisticResult.objects.filter(slug=self.slug).delete()
|
||||
return StatisticResult.objects.none()
|
||||
|
||||
def get_results_data(self):
|
||||
results = self.get_results()
|
||||
|
||||
Reference in New Issue
Block a user