Merge lp:~aaronp/software-center/fix-794060-for-4.0 into lp:software-center/4.0

Proposed by Aaron Peachey
Status: Merged
Merged at revision: 1777
Proposed branch: lp:~aaronp/software-center/fix-794060-for-4.0
Merge into: lp:software-center/4.0
Diff against target: 49 lines (+16/-4)
2 files modified
softwarecenter/view/appdetailsview_gtk.py (+4/-1)
softwarecenter/view/widgets/reviews.py (+12/-3)
To merge this branch: bzr merge lp:~aaronp/software-center/fix-794060-for-4.0
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+65113@code.launchpad.net

Description of the change

additional fix for bug LP #794060
original fix stopped duplicates upon usefulness and flagging but still resulted in duplicates after submitting a new review

this fix now prevents duplicates upon submitting a review too

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

This looks great and does the trick just fine in testing. Thanks very much for taking care of this, Aaron!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/view/appdetailsview_gtk.py'
2--- softwarecenter/view/appdetailsview_gtk.py 2011-06-10 13:31:11 +0000
3+++ softwarecenter/view/appdetailsview_gtk.py 2011-06-19 05:23:23 +0000
4@@ -831,8 +831,11 @@
5 if action:
6 self._review_update_single(action, single_review)
7 else:
8+ curr_list = self.reviews.get_all_review_ids()
9 for review in reviews_data:
10- self.reviews.add_review(review)
11+ if not review.id in curr_list:
12+ self.reviews.add_review(review)
13+
14 self.reviews.configure_reviews_ui()
15
16 def on_test_drive_clicked(self, button):
17
18=== modified file 'softwarecenter/view/widgets/reviews.py'
19--- softwarecenter/view/widgets/reviews.py 2011-06-10 13:31:11 +0000
20+++ softwarecenter/view/widgets/reviews.py 2011-06-19 05:23:23 +0000
21@@ -856,9 +856,12 @@
22 else:
23 self.vbox.pack_start(NoReviewYet())
24
25- # only show the "More" button if there is a chance that there
26- # are more
27- if self.reviews and len(self.reviews) % REVIEWS_BATCH_PAGE_SIZE == 0:
28+ # aaronp: removed check to see if the length of reviews is divisible by
29+ # the batch size to allow proper fixing of LP: #794060 as when a review
30+ # is submitted and appears in the list, the pagination will break this
31+ # check and make it unreliable
32+ #if self.reviews and len(self.reviews) % REVIEWS_BATCH_PAGE_SIZE == 0:
33+ if self.reviews:
34 # mvo: the lines below are only needed because "Moreā€¦" is
35 # actually translated already
36 # button = gtk.Button(_("Show more reviews"))
37@@ -897,6 +900,12 @@
38 self.reviews.remove(r)
39 break
40 return
41+
42+ def get_all_review_ids(self):
43+ ids = []
44+ for review in self.reviews:
45+ ids.append(review.id)
46+ return ids
47
48 def clear(self):
49 self.reviews = []

Subscribers

People subscribed via source and target branches