Skip to content

Commit

Permalink
Fix logic for current activites to include an actual end date between…
Browse files Browse the repository at this point in the history
… one year ago and now
  • Loading branch information
dalepotter committed Aug 5, 2015
1 parent a8c8ef1 commit b5725df
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions stats/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit b5725df

Please sign in to comment.