Comments (11)
As points are just an integer, what I do is define an observer which updates de points
field directly. I don't see a reason to define an API for that, as we are not saving history on that field yet; Merit treats it as a simple integer change.
When we need more logic than the provided "visited this action", we change that value inside controller actions.
Would this fit your needs?
from merit.
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.
from merit.
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!
from merit.
Great! We'll look at adding them to Merit first.
from merit.
Our first thought was a polymorphic Point
model that would be would be an
from merit.
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").
from merit.
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.
from merit.
Scores
is a good model name, and inside of scores we have category
, points
(the final computed value) and sash_id
("target", no need of polymorphism thanks to that intermediary object).
The Score#points
attribute builds from PointsLog
, which holds score_id
, points
and description
string (have to define a nice way of logging yet, so we get the action, source, etc).
I'm also thinking out loud, but this should serve as a rather good foundation.
from merit.
@MarkBorcherding, just reviewed all your commits. I just cherry-picked a nice refactoring. What I saw is that through AwardedPoint
(which I'll call Score
) you were able to handle different categories, but not history.
My sketch adds the PointsLog
for logging everything related to that attribute, pretty important for recomputing rules if they are adjusted, and monitoring changes and how do points move in the system.
So I'll start this changeset in the opposite direction: will get running both new models, focus on the PointLog
functionality, ignore for now Score#category
string attribute, and then make categories work.
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!
from merit.
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.
from merit.
Just released merit version 1.0.0.
- About points on models, with callbacks it will work, check the new
add_points
andsubstract_points
methods. - Points history is done. From a meritable resource, check it's scores, and inside of it the point entries, that's the history from where we compute
user#points
, which is now an SQLSUM
instead of an attribute. More info in https://github.com/tute/merit/wiki. - Recording points in specific skills will come out almost automatically from
scores
indirection, not yet done though. As this issue is becoming a little cluttered, I'll close it; we may open a new one withMerit::Score#category
testing and implementation if you need it.
Thanks for your feedback and help!
from merit.
Related Issues (20)
- undefined method 'create' for Merit:Action:Class HOT 12
- Use DeviseInvitable with Merit HOT 2
- Display flash messages to notify users when they obtain badges/points HOT 9
- Adding points doesn't work the first time HOT 1
- Display a specific badge and the users who obtained it HOT 2
- Merit 4.0 causing Heroku deployment errors HOT 4
- Typo in active_record/merit_generator task
- Deprecation warning: Expected string default value for '--orm'; got false (boolean). HOT 3
- Granting badges with Devise Registrations#update not working HOT 11
- rails g merit:install don't generating migrations on Rails6 HOT 18
- can't write unknown attribute `sash_id` when calling points method on user HOT 3
- subtract_points is not working HOT 3
- Missing index on merit_actions table for processed HOT 2
- Error on create merit_actions migration file HOT 2
- Score on namespaced/controller#action, can not trigger Merit::Action HOT 6
- Error every time code changes HOT 7
- do not support grape? HOT 1
- Devise & Sign-in then trigger grant_on HOT 12
- On destroy, Integer returned instead of object HOT 11
- Urgent Help : Duplicate key entry HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from merit.