Actually, you can just set the fields to NULL and they'll regenerate the
next time they're needed. That way you guarantee you get the counts as we
calculate them.

This is effectively what we'll do in beta 3.

Christian

-- 
Christian Hammond - chip...@chipx86.com
Review Board - http://www.reviewboard.org
VMware, Inc. - http://www.vmware.com


On Thu, May 12, 2011 at 12:14 AM, Stefan Lenselink <ste...@hostnet.nl>wrote:

> We also had broken counts in our 1.6 beta 1 instance. We are running it
> using a MySQL database, so to fix the counters we wrote the following SQL
> script which we run once a day:
>
> #All My Requests:
> update accounts_localsiteprofile as lp set lp.total_outgoing_request_count
> = (SELECT count(*)  FROM reviews_reviewrequest as r WHERE r.submitter_id =
> lp.user_id);
>
> #Stared:
> update accounts_localsiteprofile as lp set lp.starred_public_request_count
> = (SELECT count(*) FROM accounts_profile_starred_review_requests as s WHERE
> s.profile_id = lp.profile_id);
>
> #Outgoing:
> update accounts_localsiteprofile as lp set
> lp.pending_outgoing_request_count = (SELECT count(*)  FROM
> reviews_reviewrequest as r WHERE r.submitter_id = lp.user_id AND STATUS =
>  'P');
>
> #Incomming:
> update accounts_localsiteprofile as lp set lp.total_incoming_request_count
> = (SELECT count(*) FROM reviews_reviewrequest as r left join
>                         reviews_reviewrequest_target_people as p on
>  p.reviewrequest_id = r.id left join
>                         reviews_reviewrequest_target_groups as g on
> g.reviewrequest_id = r.id join
>                         reviews_group_users as gu on gu.group_id =
> g.group_id
>                 WHERE         (lp.user_id = gu.user_id OR lp.user_id =
> p.user_id) and r.status = 'P' group by lp.user_id)
>
> update accounts_localsiteprofile as lp set lp.total_incoming_request_count
> = 0 where lp.total_incoming_request_count is null;
>
> #TOME:
> update accounts_localsiteprofile as lp set lp.direct_incoming_request_count
> = (SELECT count(*) FROM reviews_reviewrequest_target_people as p join
> reviews_reviewrequest as r on p.reviewrequest_id = r.id WHERE p.user_id=
> lp.user_id and r.status = 'P' group by p.user_id);
> update accounts_localsiteprofile as lp set lp.direct_incoming_request_count
> = 0 where lp.direct_incoming_request_count is null;
>
>
> We are looking into upgrading to 1.6 beta 2 as well, once we have upgraded
> we don't have to run these querys again :)
>
> Hope this might be helpful for someone.
>
> Stefan
> ----- Original Message -----
> From: "Dan Savilonis" <d...@n-cube.org>
> To: "reviewboard" <reviewboard@googlegroups.com>
> Sent: Wednesday, May 11, 2011 10:57:53 PM
> Subject: Re: Review Board 1.6 beta 2 - For real this time!
>
> Ah, I suspected that it might be in the database.
>
> Thanks,
> Dan
>
> On May 11, 2:54 pm, Christian Hammond <chip...@chipx86.com> wrote:
> > It fixes all future ones going forward. We need to reset the broken 1.6
> beta
> > 1 counts, which I'm still trying to figure out the best way to do. It'll
> > happen by the next beta, unless there's some emergency that forces us to
> put
> > the beta out sooner than planned.
> >
> > We have a Review Board instance with negative counts too. I'm keeping it
> > that way as a reminder :)
> >
> > Christian
> >
> > --
> > Christian Hammond - chip...@chipx86.com
> > Review Board -http://www.reviewboard.org
> > VMware, Inc. -http://www.vmware.com
> >
> >
> >
> >
> >
> >
> >
> > On Wed, May 11, 2011 at 10:59 AM, Dan Savilonis <d...@n-cube.org> wrote:
> > > Upgrade to 1.6 beta 2 went fine for me. However, I noticed there are a
> > > couple lines in the release note indicating some fixes for incoming
> > > review and starred review request counts. This doesn't seem to have
> > > fixed the counts for me. I currently have -15 incoming reviews and -1
> > > outgoing reviews. I've noticed it slowly decrementing since we
> > > installed 1.6 beta 1 :)
> >
> > > Dan
> >
> > > On May 10, 3:03 am, "Ashithraj Shetty" <asithraj.she...@gmail.com>
> > > wrote:
> > > > Upgraded to the latest release. Big bad box is not seen anymore J
> >
> > > > -Ashith
> >
> > > > From: reviewboard@googlegroups.com [mailto:
> reviewboard@googlegroups.com]
> > > On
> > > > Behalf Of Christian Hammond
> > > > Sent: Tuesday, May 10, 2011 11:37 AM
> > > > To: reviewboard@googlegroups.com
> > > > Subject: Review Board 1.6 beta 2 - For real this time!
> >
> > > > Let's try this again.
> >
> > > > 1.6 beta 2 is out! It should work with PostgreSQL and shouldn't have
> a
> > > giant
> > > > box at the bottom of every page. Give it a try!
> >
> > > > Christian
> >
> > > > --
> > > > Christian Hammond - chip...@chipx86.com
> > > > Review Board -http://www.reviewboard.org
> > > > VMware, Inc. -http://www.vmware.com
> >
> > > > --
> > > > Want to help the Review Board project? Donate today athttp://
> > >www.reviewboard.org/donate/
> > > > Happy user? Let us know athttp://www.reviewboard.org/users/
> > > > -~----------~----~----~----~------~----~------~--~---
> > > > To unsubscribe from this group, send email to
> > > > reviewboard+unsubscr...@googlegroups.com
> > > > For more options, visit this group athttp://
> > > groups.google.com/group/reviewboard?hl=en
> >
> > > --
> > > Want to help the Review Board project? Donate today at
> > >http://www.reviewboard.org/donate/
> > > Happy user? Let us know athttp://www.reviewboard.org/users/
> > > -~----------~----~----~----~------~----~------~--~---
> > > To unsubscribe from this group, send email to
> > > reviewboard+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/reviewboard?hl=en
>
> --
> Want to help the Review Board project? Donate today at
> http://www.reviewboard.org/donate/
> Happy user? Let us know at http://www.reviewboard.org/users/
> -~----------~----~----~----~------~----~------~--~---
> To unsubscribe from this group, send email to
> reviewboard+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/reviewboard?hl=en
>
> --
> Want to help the Review Board project? Donate today at
> http://www.reviewboard.org/donate/
> Happy user? Let us know at http://www.reviewboard.org/users/
> -~----------~----~----~----~------~----~------~--~---
> To unsubscribe from this group, send email to
> reviewboard+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/reviewboard?hl=en
>

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en

Reply via email to