Skip to content

Commit

Permalink
updated pdf
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.vrenesis.com/tasklance/trunk@3487 e4e18489-d04f-4dbd-bd3b-2e29156f5e3f
  • Loading branch information
mreiferson committed Dec 6, 2009
1 parent 385b8ea commit 03b87c6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
15 changes: 14 additions & 1 deletion apps/projman/models.py
@@ -1,6 +1,6 @@
from django.db import models
from django.contrib.auth.models import User
from datetime import datetime
from datetime import datetime, timedelta
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic

Expand Down Expand Up @@ -36,6 +36,19 @@ def get_thread(self):
ctype = ContentType.objects.get_for_model(self)
return Thread.objects.get(content_type__pk=ctype.id, object_id=self.id)

def any_milestones(self):
min_date = datetime.today() + timedelta(days=-7)
milestones_active = self.milestone_set.filter(status__exact='active')
milestones_onhold = self.milestone_set.filter(status__exact='onhold')
mc = self.milestone_set.filter(status__exact='complete')

milestones_complete = []
for m in mc:
if m.last_status_change().timestamp > min_date:
milestones_complete.append(m)

return (milestones_active.count() or milestones_onhold.count() or len(milestones_complete))

def save(self):
if not self.created:
self.created = datetime.now()
Expand Down
14 changes: 7 additions & 7 deletions apps/projman/templates/report_weekly.html
Expand Up @@ -21,13 +21,13 @@
<div id="account" rel="{{ request.account.id }}">
<div id="categories">
{% for category in request.account.category_set.all %}
{% if category.milestone_set.count %}
<div id="category{{ category.id }}" rel="{{ category.id }}" class="category">
<h1><a href="{% url pm_delcategory category.id %}"><img src="/site_media/images/report_delete.gif" alt="Delete Category"/></a> <a href="{% url pm_overview category.id %}"><span class="categoryName" rel="name">{{ category.name }}</span></a></h1>
<div class="categoryDescription" rel="description">{{ category.description }}</div>
{% show_milestones category %}
</div>
{% endif %}
{% if category.any_milestones %}
<div id="category{{ category.id }}" rel="{{ category.id }}" class="category">
<h1><a href="{% url pm_delcategory category.id %}"><img src="/site_media/images/report_delete.gif" alt="Delete Category"/></a> <a href="{% url pm_overview category.id %}"><span class="categoryName" rel="name">{{ category.name }}</span></a></h1>
<div class="categoryDescription" rel="description">{{ category.description }}</div>
{% show_milestones category %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
Expand Down

0 comments on commit 03b87c6

Please sign in to comment.