Skip to content

Commit

Permalink
Merge pull request #506 from cillian/homepage-work-panel
Browse files Browse the repository at this point in the history
Show most recently updated work first and only work updated in last 6 months
  • Loading branch information
bhaugen authored Jun 24, 2016
2 parents 2b7ba14 + d7346d9 commit 7ab53e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions valuenetwork/templates/_work_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
<ul>
{% for item in work_to_do %}
<li>
{% trans "Type of work" %}: <b>{{ item.resource_type.name }}:</b> {% trans "due" %} {{ item.due_date }}</br>
<b>{{ item.resource_type.name }}</b> &mdash; {% trans "updated" %} {{ item.changed_date }}</br>
{% if item.process %}
<i>{% trans "Purpose:" %} {{ item.description }}</i>
<p style="margin-left: 1em; margin-bottom: 0; font-size: 90%;">
<a href="{% url unfold_commitment commitment_id=item.id %}">Learn more...</a>
</p>

{% comment %}
<div style="display: inline;" >
<a href="" role="button" class="btn btn-info" title="This button does not work yet. It will soon.">
{% trans "do this work?" %}
</a>
</div>
</div>
<p style="margin-left: 1em; margin-bottom: 0; font-size: 90%;">
{% trans "for process" %}: <a href="{% url unfold process_id=item.process.id %}">{{ item.process.name }}</a>
</p>
{% endcomment %}
{% endif %}
</li>
{% endfor %}
</ul>
</ul>
9 changes: 6 additions & 3 deletions valuenetwork/valueaccounting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,14 @@ def home(request):
return render_to_response("homepage.html",
template_params,
context_instance=RequestContext(request))

def work_to_do(template_params):
six_months_ago = datetime.datetime.now() - datetime.timedelta(weeks=26)
template_params["work_to_do"] = Commitment.objects.unfinished().filter(
from_agent=None,
event_type__relationship="work")
from_agent=None,
event_type__relationship="work",
changed_date__gte=six_months_ago).order_by("-changed_date")

return template_params

@login_required
Expand Down

0 comments on commit 7ab53e0

Please sign in to comment.