-
Notifications
You must be signed in to change notification settings - Fork 197
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
Creating Point Rules Outside of Controllers #24
Comments
As points are just an integer, what I do is define an observer which updates de When we need more logic than the provided "visited this action", we change that value inside controller actions. Would this fit your needs? |
Updating points directly was my alternative. It does spread the point logic out from a place where it's held nice and tidy tight now. The history is another feature we are considering adding. We typically show our points history as a spark line, and are considering some type of point snapshot every time points change along with some daily aggregation and sparse data population. Another feature we're needing is recording points in specific skills (e.g. strength, dexterity, charisma, etc). We were planning on building our own pointing and badging, but found Merit and loved it's simplicity. I don't know if bloating Merit with our additions is desirable. We may end up with our own anyway, but Merit looks great. |
Interesting. Saving the history for points granting is definitely desirable. And agree that spreading the reputation logic out is not best. Points right now are the greenest part of Merit: only one attribute, no history, kind of too simple. I don't think it would be bad to add some logic to it. Right now I'm merging a little fix for allowing different point rules on same controller actions. I have a project which would benefit from having split points (as "normal" user and as other type of users), so I'm open to suggestions. Thanks for your feedback! |
Great! We'll look at adding them to Merit first. |
Our first thought was a polymorphic |
Yes, makes sense. So, a User has_many Points (or better name). And we would need a PointsLog model for logging these kinds of changes. We'll also need a method for adding points to a meritable resource ("User"). |
Woops. Prematurely hit send there. Yea. A user has many points/score/award. Each point can have a value, timestamp, category (e.g. strength, charisma), a target maybe (e.g. the post that earned the points) and maybe an action (e.g. edited, approved). That was our thought, but, as usual, I don't know if we're overcomplicating things. |
The I'm also thinking out loud, but this should serve as a rather good foundation. |
@MarkBorcherding, just reviewed all your commits. I just cherry-picked a nice refactoring. What I saw is that through My sketch adds the So I'll start this changeset in the opposite direction: will get running both new models, focus on the Are you using your fork/branch in an app, so we can test? My goal is to do some plumbing but not change the API whenever possible. Thanks! |
Unfortunately, the project we were planning to use Merit on got stalled, and still hasn't picked up. I wouldn't worry about perserving any API I created. We aren't using it anywhere and once we pick back up on it, we can just adapt what we have then. |
Just released merit version 1.0.0.
Thanks for your feedback and help! |
Is there any interest from anyone else in creating point rules that are observable on the model rather than on controller actions"? We have a large use for creating points off events other than controller actions, such as cron jobs, Twitter streams, etc.
I was thinking of adding model callbacks to the points DSL and using observables to assign the points. Something like this:
Then
notify_observers :retweet
in theTweet
model.Just spitballing some ideas with exactly what the DSL would be. I'm not sure if there is any interest in this, or if our case is unique.
The text was updated successfully, but these errors were encountered: