Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def tip_for commit
tip = Tip.create({
project: self,
user: user,
amount: next_tip_amount,
amount: next_tip_amount * (multiplier_for commit),
commit: commit.sha
})

Expand All @@ -94,6 +94,21 @@ def tip_for commit

end

def multiplier_for commit
hashtag = commit.commit.message[/#[a-z]*/i]

if hashtag
hashtag = hashtag[1..-1].downcase
if CONFIG['tiers'].has_key?(hashtag)
CONFIG['tiers'][hashtag]
else
1
end
else
1
end
end

def available_amount
self.deposits.where("confirmations > 0").map(&:available_amount).sum - tips_paid_amount
end
Expand Down
12 changes: 11 additions & 1 deletion config/config.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ smtp_settings:
# api_key: 111111111111
# host: errbit.tip4commit.com


# Payout tiers, multipliers on the below tip amount
tiers:
free: 0
tiny: 0.1
small: 0.5
average: 1
large: 2
huge: 10

tip: 0.01
min_payout: 100000
our_fee: 0.05
our_fee: 0.05