Hi
I am using Drupal 6.20, Views 2, OG 2.1 and OG Statistics 1.x-dev

I need to show a list of recently active Groups where either a new Group Post has been posted or a new comment has been added to an existing Group Post.

OG Statistics (wonderfully serving my needs so far, thanks!) provides separately the two information:

Group Statistics: Last Comment-time
Group Statistics: Last inserted/updated Node-time

but I need to merge the two, I would need to use the TWO sort criteria together but simply adding both of them I get either one or the other to affetct the sorting according to their adding order.

How would you get a VIEW with Group Nodes sorted by most recent date of LAST COMMENT TIME *AND* LAST INSERTED NOTE TIME?

Thanks to anybody who could help.

Cheers,

AM.

Comments

dawehner’s picture

With quite some custom code.

There you could add a custom sort handler to ORDER BY a + b. Pretty sure this will not be fast.

So you would have to extend the table to add a column for the two values.
Then you extend the views integration and add this new column to it.

I doubt that such a feature makes sense in og_statistics in general.

hefox’s picture

A last_activity_timestamp field could make some sense, but what it means could be very debatable -- some would want last comment, last node (inserted? updated?), but others might want last user subscribed also.

angelmax’s picture

Thanks guys.
It was an old project. I solved it with custom sql. I am not sure I even have a copy of it.
A.M.

hefox’s picture

Status: Active » Fixed
nicl’s picture

Just to add that I am working on a project at the moment which requires some kind of 'last_activity_timestamp'.

I guess for most people who want this, they want to use this timestamp as a metric of group (recent) activity. So logically I suspect latest of every indicator (node change | comment change | member change) would be best - where 'change' means any change, such as a node insert/edit, except perhaps for delete operations.

If I end up implementing this, I'll attach a patch.

hefox’s picture

nicl: it'd be fairly easy to include a setting for this so users can choice which data to include. Also, it may or may nt help you to use #1516036: Make og stats more condusive to custom logic patch since recalculating stats is done in one function

Status: Fixed » Closed (fixed)
Issue tags: -views, -OG, -sorting, -dates, -og_statistics

Automatically closed -- issue fixed for 2 weeks with no activity.

benjarlett’s picture

Issue summary: View changes

patch works for me against dev too