summaryrefslogtreecommitdiff
path: root/lib/Multi/Maintenance.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-11-16 10:00:16 +0100
committerYorhel <git@yorhel.nl>2009-11-16 10:01:02 +0100
commit445b96631ac06d2fb0c3b6486ccde2a189a58675 (patch)
tree2bdcdbf0912756af65b36e20c7b271b5e2386abf /lib/Multi/Maintenance.pm
parent207ecaadc6e746e05d44acc96adbc30e64a87cee (diff)
parenta5e88fd33c3ec018e89be0b5368a85119323554c (diff)
Merge branch 'beta'2.9
+ Changelog update
Diffstat (limited to 'lib/Multi/Maintenance.pm')
-rw-r--r--lib/Multi/Maintenance.pm18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/Multi/Maintenance.pm b/lib/Multi/Maintenance.pm
index 4f816e56..0ea7ef29 100644
--- a/lib/Multi/Maintenance.pm
+++ b/lib/Multi/Maintenance.pm
@@ -17,12 +17,12 @@ sub spawn {
package_states => [
$p => [qw|
_start shutdown set_daily daily set_monthly monthly log_stats
- vncache tagcache vnpopularity cleangraphs
+ vncache tagcache vnpopularity vnrating cleangraphs
usercache statscache logrotate
|],
],
heap => {
- daily => [qw|vncache tagcache vnpopularity cleangraphs|],
+ daily => [qw|vncache tagcache vnpopularity vnrating cleangraphs|],
monthly => [qw|usercache statscache logrotate|],
@_,
},
@@ -117,6 +117,20 @@ sub vnpopularity {
}
+sub vnrating {
+ # takes less than a second, but can be performed in ranges as well when necessary
+ $_[KERNEL]->post(pg => do => q|
+ UPDATE vn SET
+ c_rating = (SELECT (
+ ((SELECT COUNT(vote)::real/COUNT(DISTINCT vid)::real FROM votes)*(SELECT AVG(a)::real FROM (SELECT AVG(vote) FROM votes GROUP BY vid) AS v(a)) + SUM(vote)::real) /
+ ((SELECT COUNT(vote)::real/COUNT(DISTINCT vid)::real FROM votes) + COUNT(uid)::real)
+ ) FROM votes WHERE vid = id AND uid NOT IN(SELECT id FROM users WHERE ign_votes)
+ ),
+ c_votecount = COALESCE((SELECT count(*) FROM votes WHERE vid = id AND uid NOT IN(SELECT id FROM users WHERE ign_votes)), 0)
+ |, undef, 'log_stats', 'vnrating');
+}
+
+
sub cleangraphs {
# should be pretty fast
$_[KERNEL]->post(pg => do => q|