Show last activity of ordergroups

This commit is contained in:
Patrick Gansterer 2016-02-18 00:00:55 +01:00 committed by wvengen
parent 4cacb740d1
commit 8b8693df5a
4 changed files with 11 additions and 1 deletions

View file

@ -26,6 +26,13 @@ class Ordergroup < Group
User.natural_order.all.reject { |u| (users.include?(u) || u.ordergroup) } User.natural_order.all.reject { |u| (users.include?(u) || u.ordergroup) }
end end
def last_user_activity
last_active_user = users.order('users.last_activity DESC').first
if last_active_user
last_active_user.last_activity
end
end
# the most recent order this ordergroup was participating in # the most recent order this ordergroup was participating in
def last_order def last_order
orders.order('orders.starts DESC').first orders.order('orders.starts DESC').first

View file

@ -7,6 +7,7 @@
%tr %tr
%th= heading_helper Ordergroup, :name %th= heading_helper Ordergroup, :name
%th= heading_helper Ordergroup, :user_tokens %th= heading_helper Ordergroup, :user_tokens
%th= heading_helper Ordergroup, :last_user_activity
%th= heading_helper Ordergroup, :last_order %th= heading_helper Ordergroup, :last_order
%tbody %tbody
@ -14,5 +15,5 @@
%tr %tr
%td= ordergroup.name %td= ordergroup.name
%td=h ordergroup.users.collect { |u| show_user(u) }.join(", ") %td=h ordergroup.users.collect { |u| show_user(u) }.join(", ")
%td= format_date ordergroup.last_user_activity
%td= format_date ordergroup.last_order.try(:starts) %td= format_date ordergroup.last_order.try(:starts)

View file

@ -105,6 +105,7 @@ de:
description: Beschreibung description: Beschreibung
ignore_apple_restriction: Bestellstop bei zu wenig Äpfeln ignorieren ignore_apple_restriction: Bestellstop bei zu wenig Äpfeln ignorieren
last_order: Zuletst bestellt last_order: Zuletst bestellt
last_user_activity: Zuletzt aktiv
name: Name name: Name
user_tokens: Mitglieder user_tokens: Mitglieder
page: page:

View file

@ -106,6 +106,7 @@ en:
description: Description description: Description
ignore_apple_restriction: Ignore order stop by apple points restriction ignore_apple_restriction: Ignore order stop by apple points restriction
last_order: Last order last_order: Last order
last_user_activity: Last activity
name: Name name: Name
user_tokens: Members user_tokens: Members
page: page: