Skip to content

Commit

Permalink
Merge pull request #1619 from unicef/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ntrncic authored Jun 1, 2018
2 parents 3c2dfa6 + f244078 commit 4577bb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions src/etools/applications/partners/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,17 +643,14 @@ def planned_visits_to_hact(self):
If partner type is Government, then default to 0 planned visits
"""
year = datetime.date.today().year
if self.partner_type == 'Government':
try:
pv = self.planned_visits.get(year=year)
pvq1 = pv.programmatic_q1
pvq2 = pv.programmatic_q2
pvq3 = pv.programmatic_q3
pvq4 = pv.programmatic_q4
except PartnerPlannedVisits.DoesNotExist:
pvq1 = pvq2 = pvq3 = pvq4 = 0
else:
try:
pv = self.planned_visits.get(year=year)
pvq1 = pv.programmatic_q1
pvq2 = pv.programmatic_q2
pvq3 = pv.programmatic_q3
pvq4 = pv.programmatic_q4
except PartnerPlannedVisits.DoesNotExist:
pvq1 = pvq2 = pvq3 = pvq4 = 0

hact = json.loads(self.hact_values) \
if isinstance(self.hact_values, six.text_type) \
Expand Down
2 changes: 1 addition & 1 deletion src/etools/applications/partners/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def test_planned_visits_gov(self):
)
self.assertEqual(
self.partner_organization.hact_values['programmatic_visits']['planned']['total'],
0
3
)

def test_planned_visits_non_gov(self):
Expand Down

0 comments on commit 4577bb9

Please sign in to comment.