Skip to content

Commit

Permalink
report week addition
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeyabal committed Aug 17, 2016
1 parent b970c14 commit c309701
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
21 changes: 20 additions & 1 deletion malaria24/ona/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,22 @@ def get_digest_email_data(self):
'under5': under5,
'over5': over5,
'week': week})
if province_cases:
start_date = province_cases \
.first().create_date_time.strftime(
"%d %B %Y"
)
end_date = province_cases \
.last().create_date_time.strftime(
"%d %B %Y"
)
week = "{0} to {1}".format(start_date, end_date)
totals = {}
totals['total_cases'] = total_cases
totals['total_females'] = total_females
totals['total_males'] = total_males
totals['total_under5'] = total_under5
totals['total_over5'] = total_over5

return {
'digest': self,
'provinces': provinces,
Expand Down Expand Up @@ -209,6 +218,16 @@ def get_digest_email_data(self, province, facility_code):
'under5': under5,
'over5': over5,
'week': week})
if district_cases:
start_date = district_cases \
.first().create_date_time.strftime(
"%d %B %Y"
)
end_date = district_cases \
.last().create_date_time.strftime(
"%d %B %Y"
)
week = "{0} to {1}".format(start_date, end_date)
totals = {}
totals['total_cases'] = total_cases
totals['total_females'] = total_females
Expand Down
20 changes: 11 additions & 9 deletions malaria24/ona/templates/ona/html_district_digest.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@
<th>Over 5</th>
</tr>
{% for facility in facility %}
<tr>
<td><strong>{{facility.facility}}</strong></td>
<td style="text-align: right;"><strong>{{facility.district}}</strong></td>
<td style="text-align: right;"><strong>{{facility.cases}}</strong></td>
<td style="text-align: right;"><strong>{{facility.males}}</strong></td>
<td style="text-align: right;"><strong>{{facility.females}}</strong></td>
<td style="text-align: right;"><strong>{{facility.under5}}</strong></td>
<td style="text-align: right;"><strong>{{facility.over5}}</strong></td>
</tr>
{% if facility.cases %}
<tr>
<td><strong>{{facility.facility}}</strong></td>
<td style="text-align: right;"><strong>{{facility.district}}</strong></td>
<td style="text-align: right;"><strong>{{facility.cases}}</strong></td>
<td style="text-align: right;"><strong>{{facility.males}}</strong></td>
<td style="text-align: right;"><strong>{{facility.females}}</strong></td>
<td style="text-align: right;"><strong>{{facility.under5}}</strong></td>
<td style="text-align: right;"><strong>{{facility.over5}}</strong></td>
</tr>
{% endif %}
{% endfor %}
<tr>
<td></td>
Expand Down
2 changes: 2 additions & 0 deletions malaria24/ona/templates/ona/html_national_digest.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<th>Over 5</th>
</tr>
{% for province in provinces %}
{% if province.cases %}
<tr>
<td>{{province.province}}</td>
<td style="text-align: right;">{{province.cases}}</td>
Expand All @@ -40,6 +41,7 @@
<td style="text-align: right;">{{province.under5}}</td>
<td style="text-align: right;">{{province.over5}}</td>
</tr>
{% endif %}
{% endfor %}
<tr>
<td><strong>Total</strong></td>
Expand Down

0 comments on commit c309701

Please sign in to comment.