fix of Post/Thread rating system
This commit is contained in:
parent
caf859129d
commit
063b69afbe
5 changed files with 126 additions and 32 deletions
|
|
@ -31,6 +31,7 @@
|
|||
- fix: Project manager tasks get cached (not clearing) when bouncing between edit and new
|
||||
- fix: Creating a new account when purchasing something properly redirects users to the checkout page
|
||||
- fix: Group expiration dates on subscriptions are now correct
|
||||
- fix: Rating numbers drop after rating asset (perlDreamer Consulting, LLC)
|
||||
|
||||
7.3.8
|
||||
- Fixed a template variable rewriting problem with HTML::Template::Expr
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use lib "../../lib";
|
|||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset;
|
||||
|
||||
|
||||
my $toVersion = "7.3.9"; # make this match what version you're going to
|
||||
|
|
@ -22,7 +23,7 @@ my $session = start(); # this line required
|
|||
|
||||
# upgrade functions go here
|
||||
fixCalendarFeedsLastUpdatedField($session);
|
||||
|
||||
addThreadRatingColumn($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -42,6 +43,29 @@ sub fixCalendarFeedsLastUpdatedField {
|
|||
$session->db->write("alter table Calendar_feeds modify column lastUpdated datetime");
|
||||
}
|
||||
|
||||
##-------------------------------------------------
|
||||
sub addThreadRatingColumn {
|
||||
my $session = shift;
|
||||
print "\tAdding Thread rating column\n" unless ($quiet);
|
||||
$session->db->write("alter table Thread add column threadRating integer default 0");
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $threads = $root->getLineage(
|
||||
['descendents'],
|
||||
{
|
||||
returnObjects => 1,
|
||||
includeOnlyClasses => ['WebGUI::Asset::Post::Thread'],
|
||||
includeArchived => 1,
|
||||
},
|
||||
);
|
||||
foreach my $thread ( @{ $threads} ) {
|
||||
##Fix all double accounting on the thread
|
||||
$thread->recalculatePostRating;
|
||||
|
||||
##Recalculate the thread rating and also update the CS!
|
||||
$thread->updateThreadRating;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE ----
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue