thomas Posted October 10, 2013 Share Posted October 10, 2013 (edited) Hello, is there a way to sort pages by a computed value other than using raw MySQL? I have about 2000 pages which all have a "views" field. Now I'd like to sort them by "views per day", so calculate the age of the post in days and divide the views by the age. I thought about a LazyCron which computes this value every now and then and writes them into a field but this would mean the value is always outdated and I'm not sure how long the cron would take on a large number of pages ... Has anyone got any suggestions on how to do this? Thanks, thomas Solved. Sorry. Next time I think before I post I now update the "views per day" value every time the "views" value is updated. This is of course a bit inaccurate since the views might not get updated for a couple of days but I figured that's a small price to pay for not having a cron iterate over the pages every so often. Edited October 10, 2013 by thomas Link to comment Share on other sites More sharing options...
SiNNuT Posted October 10, 2013 Share Posted October 10, 2013 If it's interesting for other people maybe post the 'solution' as well?? 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now