Git Product home page Git Product logo

Comments (11)

tute avatar tute commented on August 21, 2024

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.

MarkBorcherding avatar MarkBorcherding commented on August 21, 2024

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.

tute avatar tute commented on August 21, 2024

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.

MarkBorcherding avatar MarkBorcherding commented on August 21, 2024

Great! We'll look at adding them to Merit first.

from merit.

MarkBorcherding avatar MarkBorcherding commented on August 21, 2024

Our first thought was a polymorphic Point model that would be would be an

from merit.

tute avatar tute commented on August 21, 2024

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.

MarkBorcherding avatar MarkBorcherding commented on August 21, 2024

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.

tute avatar tute commented on August 21, 2024

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.

tute avatar tute commented on August 21, 2024

@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.

MarkBorcherding avatar MarkBorcherding commented on August 21, 2024

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.

tute avatar tute commented on August 21, 2024

Just released merit version 1.0.0.

  • About points on models, with callbacks it will work, check the new add_points and substract_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 SQL SUM 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 with Merit::Score#category testing and implementation if you need it.

Thanks for your feedback and help!

from merit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.