First off, I love the flag module. Great work.

I'm trying to create a view of widgets that have been flagged in the last 24 hours...easy enough. The problem comes when I'm looking to sort them. I'd like to sort the widgets in order of # of flags DESC, but only consider flags that have occurred within the past 24 hours, not the # of total (all-time) flags for a widget.

Currently, the view will display all widgets flagged in the last 24 hours, but sorts them by TOTAL number of flags DESC.

Is there any trick to making the view sort on total flags within the past 24 hours? I'm assuming it would have to look at the flag_content table and ignore the flag_counts table.

Comments

mooffie’s picture

If it's a tabular view that you want then you won't be able to do this using Views alone. Views is geared towards displaying existing data, not towards doing statistics using SQL's aggregation functions.

But if a simple listing is good for you, then once #371432: Exposing the flaggings table: Alternative Views support is done, you'll be able to do what you want using Views' "summary" mode. (Alternatively, the ViewsCalc module also comes to mind ...but it probably won't be needed.)

BTW, the last time I checked, Views couldn't sort by the "count" column (when doing a summary). It wouldn't hurt to file a feature request there. Perhaps somebody has already done this.

mooffie’s picture

In a couple of days I'll mark this issue a duplicate of #371432: Exposing the flaggings table: Alternative Views support --unless anybody thinks it isn't so.

ipllc’s picture

Thanks, mooffie. I'll look into ViewsCalc or wait out #371432.

mooffie’s picture

(Using VIewsCalc too would require completing #371432: Exposing the flaggings table: Alternative Views support. When I said "alternatively", I meant that ViewsCalc might be an alternative to View's "summary" feature, not an alternative to #371432.)

mitchell’s picture

Status: Active » Closed (duplicate)