Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Postmovement #80

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Postmovement #80

wants to merge 20 commits into from

Conversation

LucasSloan
Copy link
Contributor


self.moderator_banned = not c.user_is_admin
self.banner = c.user.name
#self.moved = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be commented out?

@LucasSloan
Copy link
Contributor Author

The changes you suggested are implemented.

@keyist
Copy link
Contributor

keyist commented Sep 6, 2013

Now that 'interestingness' is live, moving posts also needs to change descendant_karma accordingly

@LucasSloan
Copy link
Contributor Author

Moving posts?

On Thu, Sep 5, 2013 at 6:25 PM, keyist notifications@github.com wrote:

Now that 'interestingness' is live, moving posts also needs to change
descendant_karma accordingly


Reply to this email directly or view it on GitHubhttps://github.com//pull/80#issuecomment-23913411
.

"And someday when the descendants of humanity have spread from star to
star, they won't tell the children about the history of Ancient Earth until
they're old enough to bear it; and when they learn they'll weep to hear
that such a thing as Death had ever once existed!
"

-Eliezer Yudkowsky

"Trust me" means "I love you" http://project-apollo.net/mos/mos114.html

"This isn't even my final form!"

-Tim Hausler

@keyist
Copy link
Contributor

keyist commented Sep 16, 2013

Sorry, meant moving comments between posts, i.e. when a comment is moved, descendant_karma of {source,destination} parent need to be updated

@LucasSloan
Copy link
Contributor Author

Hmm. My working theory was that if the original context caused a
discussion of merit or demerit, then it's descendant_karma should reflect
that.

On Sun, Sep 15, 2013 at 11:19 PM, keyist notifications@github.com wrote:

Sorry, meant moving comments between posts, i.e. when a comment is moved,
descendant_karma of {source,destination} parent need to be updated


Reply to this email directly or view it on GitHubhttps://github.com//pull/80#issuecomment-24490715
.

"And someday when the descendants of humanity have spread from star to
star, they won't tell the children about the history of Ancient Earth until
they're old enough to bear it; and when they learn they'll weep to hear
that such a thing as Death had ever once existed!
"

-Eliezer Yudkowsky

"Trust me" means "I love you" http://project-apollo.net/mos/mos114.html

"This isn't even my final form!"

-Tim Hausler

@keyist
Copy link
Contributor

keyist commented Sep 19, 2013

It boils down to whether we want descendant_karma to have a precise meaning of "sum of present descendants' karma" or a vague meaning -- present descendants' karma + potentially vacated descendants' karma - potentially newly added descendants' karma.

I feel the latter should be avoided: deliberately storing imprecise values makes any functionality that exercises that data suspect. Sorting by descendant_karma will no longer be reliable for threads that have moved.

If you think the impact on the original context has value, then we should track both values separately (descendant_karma, accumulated_descendant_karma).

@LucasSloan
Copy link
Contributor Author

Ok, that definitely makes sense. I'll have the change up by (your) monday.

On Thu, Sep 19, 2013 at 12:02 AM, keyist notifications@github.com wrote:

It boils down to whether we want descendant_karma to have a precise
meaning of "sum of present descendants' karma" or a vague meaning --
present descendants' karma + potentially vacated descendants' karma -
potentially newly added descendants' karma.

I feel the latter should be avoided: deliberately storing imprecise values
makes any functionality that exercises that data suspect. Sorting by
descendant_karma will no longer be reliable for threads that have moved.

If you think the impact on the original context has value, then we should
track both values separately (descendant_karma,
accumulated_descendant_karma).


Reply to this email directly or view it on GitHubhttps://github.com//pull/80#issuecomment-24720553
.

"And someday when the descendants of humanity have spread from star to
star, they won't tell the children about the history of Ancient Earth until
they're old enough to bear it; and when they learn they'll weep to hear
that such a thing as Death had ever once existed!
"

-Eliezer Yudkowsky

"Trust me" means "I love you" http://project-apollo.net/mos/mos114.html

"This isn't even my final form!"

-Tim Hausler

@LucasSloan
Copy link
Contributor Author

Sorry, this is going to take more time. I've come across an issue with how
descendant karma is stored.

On Thu, Sep 19, 2013 at 9:36 AM, Lucas Sloan <
predictably.defenestrated@gmail.com> wrote:

Ok, that definitely makes sense. I'll have the change up by (your) monday.

On Thu, Sep 19, 2013 at 12:02 AM, keyist notifications@github.com wrote:

It boils down to whether we want descendant_karma to have a precise
meaning of "sum of present descendants' karma" or a vague meaning --
present descendants' karma + potentially vacated descendants' karma -
potentially newly added descendants' karma.

I feel the latter should be avoided: deliberately storing imprecise
values makes any functionality that exercises that data suspect. Sorting by
descendant_karma will no longer be reliable for threads that have moved.

If you think the impact on the original context has value, then we should
track both values separately (descendant_karma,
accumulated_descendant_karma).


Reply to this email directly or view it on GitHubhttps://github.com//pull/80#issuecomment-24720553
.

"And someday when the descendants of humanity have spread from star to
star, they won't tell the children about the history of Ancient Earth until
they're old enough to bear it; and when they learn they'll weep to hear
that such a thing as Death had ever once existed!
"

-Eliezer Yudkowsky

"Trust me" means "I love you" http://project-apollo.net/mos/mos114.html

"This isn't even my final form!"

-Tim Hausler

"And someday when the descendants of humanity have spread from star to
star, they won't tell the children about the history of Ancient Earth until
they're old enough to bear it; and when they learn they'll weep to hear
that such a thing as Death had ever once existed!
"

-Eliezer Yudkowsky

"Trust me" means "I love you" http://project-apollo.net/mos/mos114.html

"This isn't even my final form!"

-Tim Hausler

@@ -129,30 +129,50 @@ def get_rel_type_table(metadata):


def get_thing_table(metadata, name):
table = sa.Table(settings.DB_APP_NAME + '_thing_' + name, metadata,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you've caused a fair bit of duplication here. Why is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding the column doesn't work.

class MoveBox(Wrapped):
"""Used on LinkInfoPage to render the move thread form."""
def __init__(self, link_name='', captcha=None, action = 'comment'):
Wrapped.__init__(self, link_name = link_name, captcha = captcha,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the default action for a move thread form "comment"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason. Holdover from the initialization for what the movebox was created from. I'll remove it.

@jack-trikeapps
Copy link
Contributor

I think I'm still getting my head into the LW codebase and it means I'm stuck code-reviewing at the nitpick-level. I'll pull this into a private branch and have a play with it.

destination._incr('_descendant_karma', thing._descendant_karma + thing._ups - thing._downs)
if hasattr(thing, 'parent_id'):
parent = Comment._byID(thing.parent_id)
parent.incr_descendant_karma([], -(thing._descendant_karma + thing._ups - thing._downs))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pylons gives me an error here when I try to move a comment thread to a different article:

Module r2.lib.jsonresponse:181 in _Json        
>>  val = func(self, res, *a, **kw)
Module r2.controllers.validator.validator:78 in newfn        
>>  return fn(self, *a, **kw)
Module r2.controllers.api:229 in POST_move        
>>  currlink._incr('_descendant_karma', -(thing._descendant_karma + thing._ups - thing._downs))
Module r2.lib.db.thing:497 in __getattr__        
>>  return DataThing.__getattr__(self, attr)
Module r2.lib.db.thing:124 in __getattr__        
>>  raise AttributeError, '%s not found' % attr
<type 'exceptions.AttributeError'>: _descendant_karma not found 

I had created a couple of articles while on the master branch, then switched to the postmovement branch and tried to move some comments around and got this error. Perhaps it is relying on something that is not being set by current (in production) code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to run a script in the sql folder to add descendant karma to the SQL database.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you need #94.

@jack-trikeapps
Copy link
Contributor

I can't seem to move a comment tree under another comment. It will always put the comment tree at the top level:

Suppose on article A1 I have the following comment tree:

A1
 |
 `-B
   |
   `-C

And I have this comment tree on article A2:

A2
 |
 `-D

I moved comment B, giving it the URL of comment D. I expected this sort of tree:

A2
 |
 `-D
   |
   `-B
     |
     `-C

But it made this:

A2
 |
 |-D
 |
 `-B
   |
   `-C

Is this a bug or am I misunderstanding the feature request?

@jack-trikeapps
Copy link
Contributor

Also, I am seeing this error occasionally but I can't reliably reproduce it yet. Any ideas:

Module r2.lib.jsonresponse:181 in _Json        
>>  val = func(self, res, *a, **kw)
Module r2.controllers.validator.validator:78 in newfn        
>>  return fn(self, *a, **kw)
Module r2.controllers.api:232 in POST_move        
>>  parent = Comment._byID(thing.parent_id)
Module r2.lib.db.thing:282 in _byID        
>>  raise NotFound, '%s %s' % (cls.__name__, missing)
<class 'r2.lib.db.thing.NotFound'>: Comment [None] 

EDIT: Somehow I have comments with parent_id == None. Maybe it's worth setting a default parent_id of None in the Comment class? (link.py:918)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants