Meritを使用して既存のアプリに評価システムを追加しようとしています。
過去のアクティビティに基づいて、すべてのユーザーのポイントを逆算したいと考えています。Merit はいくつかのテーブルを含む非常に複雑な内部構造を持っており、いくつかの重要なステップが欠落している可能性があると思います。以下は私がこれまでに持っているものであり、この宝石に詳しい人からの指摘に感謝しています.
簡単にするために、私がしたいとしましょう
score 2, to: :user, on: 'comments#create'
そして、このようなレコードでいっぱいのコメントテーブルがあること
Comment id: 56, content: "My comment", user_id: 247, commentable_id: 2, commentable_type: 'Object', created_at: "2016-04-04 08:56:17", updated_at: "2016-04-04 17:03:55">
私の現在のアプローチは次のようになります
Comment.all.each do |c|
score_point = Merit::Score::Point.create( num_point: 2, log: nil, created_at: c.created_at)
action = Merit::Action.create(user_id: c.user_id, action_method: 'create', action_value: nil, had_errors: false, target_model: c.class.name, target_id: c.id, processed: true, created_at: c.created_at)
activity_log = Merit::ActivityLog.create( action_id: action.id, related_change_type: "Merit::Score::Point", related_change_id: score_point.id, description: "", created_at: c.created_at)
end
Merit::Score
andテーブルもありMerit::Sash
ますが、これらが何をするのか、これらのレコードも作成する必要があるのかどうかは明確ではありません。
他に見落としているものはありますか?
余談ですがMerit::Action.action_value
、 、Merit::ActivityLog.description
、Merit::Score::Point.log
、またはこれらは単なるフリー テキスト文字列の目的は何ですか?