Skip to content
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 voteScore, fix documentation, make read-only methods virtual #9

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

Conversation

idolize
Copy link

@idolize idolize commented Oct 28, 2014

  • Addresses issue score? #5 (vote scores)
  • Adds documentation for the .unvote() method (which I did not know exists until I examined the source code)
  • Switches the methods which just return a count to be virtual getters
    • Provides a nicer syntax. Ex: comment.upvotes instead of comment.upvotes()
  • Updated tests accordingly

@cristiandouce
Copy link
Owner

Thanks man! This is real awesome stuff!

I'm not sure about the virtuals, but it's not much a concern.

This would be a major release, since the API changes.

Would you give me a couple of days to take a look at it?

I may want to address a few ideas and make a 2in1.

If that's ok to you @idolize, ofc.

@idolize
Copy link
Author

idolize commented Oct 28, 2014

No prob! Yeah, I realize the virtual getters would be a breaking change. You could always support both types, but that may be overkill. Personally (and I realize it is personal preference) I vastly prefer the virtual getter way.

Also, at some point it may make sense to actually serialize the "voteScore" to the DB for querying purposes (rather than using a method or virtual property), but that opens a whole new can of worms. If you can figure that out though it'd be awesome!

@bonesoul
Copy link

bonesoul commented Nov 2, 2015

any updates on this?

@timelf123
Copy link
Contributor

Hey @cristiandouce have you had a chance to review this?

@cristiandouce
Copy link
Owner

@timelf123 not really, no... would you like to?

One idea I wanted to explore is to have some sort of scoreFormatter set by the schema configuration. That way the comment.score or whatever is called would return whatever anyone wants. The default would be a simple upvotes - downvotes... although you can notice the simplicity of this operation...

var score = comment.upvotes.length - comment.downvotes.length;

@bonesoul
Copy link

bonesoul commented May 9, 2016

@cristiandouce will this ever get merged?

@bonesoul bonesoul mentioned this pull request May 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants