Merge lp:~sinzui/launchpad/merge-karma-1 into lp:launchpad/db-devel
Status: | Merged |
---|---|
Approved by: | Aaron Bentley |
Approved revision: | no longer in the source branch. |
Merged at revision: | 9941 |
Proposed branch: | lp:~sinzui/launchpad/merge-karma-1 |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
259 lines (+147/-30) 3 files modified
database/schema/security.cfg (+2/-2) lib/lp/registry/model/person.py (+46/-3) lib/lp/registry/tests/test_person.py (+99/-25) |
To merge this branch: | bzr merge lp:~sinzui/launchpad/merge-karma-1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Aaron Bentley (community) | Approve | ||
Review via email: mp+39763@code.launchpad.net |
Description of the change
This is my branch to fix karma left on merged accounts.
lp:~sinzui/launchpad/merge-karma-1
Diff size: 250
Launchpad bug:
https:/
https:/
https:/
Test command: ./bin/test -vv -t TestPersonSetMerge
Pre-
Target release: 10.11
Fix karma left on merged accounts
-------
Merged profiles appear in the top contributors for a project because the
karma cache was not purged. The links are 404 errors (190242). User often
believe karma was lost by the merge because the karma total cache was not
updated by merge. User think they lost 1000's of karma points (3189). Users
are disappointed to see that the member since date is not updated when
merging an older profile with a younger one. (301750)
Rules
-----
* Delete the KarmaCache and KarmaTotalCache for the merged profile
* Add the karmaTotalcache from the merged profile so that the karma
points look like they are combined. This is not accurate; the
daily job will recalculate the KarmaTotalCache correctly with 24 hours.
* Use the MIN/LEAST functions to choose the oldest date of the two
profiles.
QA
--
On staging. Choose to merge an older profile with lots of karma that
also appears in a project top contributors list
* Merge the profile.
* Verify the merged profile does not appear in the top contributors
list. (The preserved profile will not appear until karma is
recalculated)
* Verify that the preserved user has more karma points on its profile
page.
* Verify that the preserved user has the older date.
Lint
----
Linting changed files:
database/
lib/lp/
lib/lp/
Test
----
Added tests for the two karma merging conditions and the oldest datecreated
condition.
* lib/lp/
Implementation
--------------
Added a method to update/delete KarmaCache and KarmaTotalCache. Added
a method to merge the oldest datecreated.
* lib/lp/
Allow the webapp to delete or update KarmaCache and KarmaTotalCache.
* database/
Please change "if result" to "if result is None" on line 33. Otherwise, looks good.