<commit_before>module Karma
  class Kalkulate

    FOUNDER_BOUNTY_MULTIPLER = 0.05
    BOUNTY_KARMA_VALUE = 10.0

    def karma_from_product_founding(product)
      kumulative_karma = 1.0  #starting karma
      #founder = User.find_by(product.user_id)
      product_bounties_n = product.tasks.won.count
      kumulative_karma = kumulative_karma + FOUNDER_BOUNTY_MULTIPLER * product_bounties_n
      return kumulative_karma
    end


    def karma_from_bounty_creation_after_completion(product)

    end

    def karma_from_bounty_completion(the_wip, user_id)
      chronicle = Chronicle.find_by(user_id: user_id)
      if not chronicle.nil?
        chronicle_id = chronicle.id
      else
        chronicle = Chronicle.create!(user_id: user_id)
        chronicle_id = chronicle.id
      end
      puts chronicle.id<commit_msg>resolved bundle issues<commit_after>module Karma
  class Kalkulate

    FOUNDER_BOUNTY_MULTIPLER = 0.05
    BOUNTY_KARMA_VALUE = 10.0
    BOUNTY_CREATOR_KARMA_SHARE = 0.3 #30%

    def karma_from_product_founding(product)
      kumulative_karma = 1.0  #starting karma
      #founder = User.find_by(product.user_id)
      product_bounties_n = product.tasks.won.count
      kumulative_karma = kumulative_karma + FOUNDER_BOUNTY_MULTIPLER * product_bounties_n
      return kumulative_karma
    end


    def karma_from_bounty_creation_after_completion(the_wip, author_id)
      user_id = author_id
      chronicle = Chronicle.find_by(user_id: user_id)
      if not chronicle.nil?
        chronicle_id = chronicle.id
      else
        chronicle = Chronicle.create!(user_id: user_id)
        chronicle_id = chronicle.id
      end

      Deed.create!({karma_value: BOUNTY_KARMA_VALUE*BOUNTY_CREATOR_KARMA_SHARE, karma_event: the_wip, user_id: author_id, chronicle_id: chronicle_id})

    end

    def karma_from_bounty_completion(the_wip, user_id)
      chronicle = Chronicle.find_by(user_id: user_id)
      if not chronicle.nil?
        chronicle_id = chronicle.id
      else
        chronicle = Chronicle.create!(user_id: user_id)
        chronicle_id = chronicle.id
      end
{'fraction_non_alphanumeric': 0.06294706723891273, 'fraction_numerical': 0.009537434430138292, 'mean_word_length': 3.2903885480572597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5487179', 'n_tokens_mistral': 797, 'n_tokens_neox': 748, 'n_words': 124}