From b5725df56b7f577a79025a8ba9dc84858d64dddc Mon Sep 17 00:00:00 2001 From: dalepotter Date: Wed, 5 Aug 2015 14:51:21 +0100 Subject: [PATCH] Fix logic for current activites to include an actual end date between one year ago and now --- stats/dashboard.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/stats/dashboard.py b/stats/dashboard.py index 575f27840b4..ab8cbf44969 100644 --- a/stats/dashboard.py +++ b/stats/dashboard.py @@ -599,20 +599,16 @@ def _comprehensiveness_is_current(self): if not(activity_planned_end_dates) and activity_status_code: if activity_status_code[0] == '2' or activity_status_code[0] == '4': return True - + # If the actual end date is within the last year, then this is a current activity for actual_end_date in activity_actual_end_dates: - if actual_end_date>=add_years(self.today, -1): + if (actual_end_date>=add_years(self.today, -1)) and (actual_end_date <= self.today): return True - else: - return False # If the planned end date is greater than today, then this is a current activity for planned_end_date in activity_planned_end_dates: if planned_end_date>=self.today: return True - else: - return False # If got this far and not met one of the conditions to qualify as a currnet activity, return false return False @@ -712,6 +708,7 @@ def empty_or_percentage_sum_is_100(path, by_vocab=False): else: return len(elements) == 1 or sum(decimal_or_zero(x.attrib.get('percentage')) for x in elements) == 100 + bools.update({ 'version': bools['version'] and self.element.getparent().attrib['version'] in CODELISTS[self._major_version()]['Version'], 'iati-identifier': bools['iati-identifier'] and reporting_org_ref and self.element.find('iati-identifier').text.startswith(reporting_org_ref),