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

neutralise karma button #578

Open
e1red opened this issue Aug 25, 2016 · 2 comments
Open

neutralise karma button #578

e1red opened this issue Aug 25, 2016 · 2 comments

Comments

@e1red
Copy link

e1red commented Aug 25, 2016

https://github.com/tricycle/lesswrong/blob/dfdc6e30f8f149651d679e209bc3fa24beea51b7/r2/r2/lib/pages/pages.py

modify this script on line 1357:
cells = ('user', 'sendmessage', 'remove')
to also include a "neutralise karma" button.
cells = ('user', 'sendmessage', 'remove', 'neutralise karma')

Also create a python script that parses all of the votes in the vote_engine by that user and adds a neutralising vote to the things they have voted on.

database structure:

    `main_engine = db_manager.get_engine(g.main_db_name,
                                    db_host = g.main_db_host,
                                    db_user = g.main_db_user,
                                    db_pass = g.main_db_pass)

comment_engine = db_manager.get_engine(g.comment_db_name,
                                    db_host = g.comment_db_host,
                                    db_user = g.comment_db_user,
                                    db_pass = g.comment_db_pass)

vote_engine = db_manager.get_engine(g.vote_db_name,
                                    db_host = g.vote_db_host,
                                    db_user = g.vote_db_user,
                                    db_pass = g.vote_db_pass)

change_engine = db_manager.get_engine(g.change_db_name,
                                      db_host = g.change_db_host,
                                      db_user = g.change_db_user,
                                      db_pass = g.change_db_pass,
                                      pool_size = 2,
                                      max_overflow = 2)

email_engine = db_manager.get_engine(g.email_db_name,
                                      db_host = g.email_db_host,
                                      db_user = g.email_db_user,
                                      db_pass = g.email_db_pass,
                                      pool_size = 2,
                                      max_overflow = 2)

query_queue_engine = db_manager.get_engine(g.query_queue_db_name,
                                           db_host = g.query_queue_db_host,
                                           db_user = g.query_queue_db_user,
                                           db_pass = g.query_queue_db_pass,
                                           pool_size = 2,
                                           max_overflow = 2)
dbm.type_db = main_engine
dbm.relation_type_db = main_engine

dbm.thing('link', main_engine, main_engine)
dbm.thing('account', main_engine, main_engine)
dbm.thing('message', main_engine, main_engine)
dbm.thing('tag', main_engine, main_engine)
dbm.thing('edit', main_engine, main_engine)
dbm.thing('meetup', main_engine, main_engine)
dbm.thing('award', main_engine, main_engine)
dbm.thing('karmaadjustment', main_engine, main_engine)
dbm.thing('pendingjob', main_engine, main_engine)

dbm.relation('savehide', 'account', 'link', main_engine)
dbm.relation('click', 'account', 'link', main_engine)
dbm.relation('subscription', 'account', 'link', main_engine)
dbm.relation('commentsubscription', 'account', 'comment', main_engine)
dbm.relation('subscriptionstorage', 'account', 'comment', main_engine)
dbm.relation('linktag', 'link', 'tag', main_engine)

dbm.thing('comment', comment_engine, comment_engine)

dbm.thing('subreddit', comment_engine, comment_engine)
dbm.relation('srmember', 'subreddit', 'account', comment_engine)

dbm.relation('friend', 'account', 'account', comment_engine)

dbm.relation('vote_account_link', 'account', 'link', vote_engine)
dbm.relation('vote_account_comment', 'account', 'comment', vote_engine)

dbm.relation('inbox_account_comment', 'account', 'comment', comment_engine)
dbm.relation('inbox_account_message', 'account', 'message', main_engine)

dbm.relation('report_account_link', 'account', 'link', main_engine)
dbm.relation('report_account_comment', 'account', 'comment', comment_engine)
dbm.relation('report_account_message', 'account', 'message', main_engine)
dbm.relation('report_account_subreddit', 'account', 'subreddit', main_engine)

dbm.thing('poll', main_engine, main_engine)
dbm.relation('ballot', 'account', 'poll', main_engine)`

Probably also want a warning between pushing the button and activating the script.

@vaniver
Copy link
Contributor

vaniver commented Aug 26, 2016

Recommend doing this as an extension of #568 ; that is, when an account's weight is changed, past votes are modified to have the new weight. That means 0ing out an account will also erase any past votes as well as shutting off future ones.

@xrpd
Copy link
Contributor

xrpd commented Aug 26, 2016

Just a note that a straightforward rollback of upvotes and downvotes can be performed based on the results of get_liked and get_disliked defined in queries.py

This probably doesn't need to be a script if some small delay (100 milliseconds?) can be inserted between each database hit to reverse the votes.

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

No branches or pull requests

3 participants