-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add karma for comments #17
Comments
In doing so, ought we to make a db model for the comments? Or could we get away with changing the comments from a list to a dict so we can store the votes for the individual comments? |
The whole db will have be reworked at some point, I am not completely sure lazydb will scale to even hundreds of thousands of records. At first glance, I think the most effective strategy will be to store all the comments within the paper data structure, as is being done, and then (for purposes of displaying / rendering the comments) store the relationships / links between the comment entities in a hash within each paper. We know that comments only exist within the scope of a paper, so I think it makes sense to keep the comments within the paper data structure for now. This reduces the complexity of the problem in that we don't have a search space of 'every' comment and its much easier to re-compute scoring for a single paper's comments. Calculation becomes a simple BFS traversal (or comparable tree search) to calculate top level nodes as well as all subsequent children. Some important use cases / considerations are: Questions: Data Structure
Scoring & KarmaProperties:
Steps:Summary: We traverse the leaf node's pcid (parent comment id) upwards towards the root, accumulating scores by 1 up the branch until the parent node (i.e. the comment thread original poster) is reached. The following are the steps to consider when a new comment is posted (which may be a reply)
Code:
OptimizationWe may consider cacheing scores and then recalculating/updating scores for posts Display CommentsWe'll need to update our algorithm for displaying comments. Luckily, our comments will always be a tree (and not a graphic with cycles) so it shouldn't be too bad. |
Prevent gaming of system by deleting / editing posts - on disable, karma
The text was updated successfully, but these errors were encountered: