| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5bf2030 commit b09992e
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -134,7 +134,7 @@ def tip_for commit | |||
| 134 | 134 | commit: commit.sha, | |
| 135 | 135 | commit_message: commit.commit.message }) | |
| 136 | 136 | ||
| 137 | - tip.notify_user | ||
| 137 | + # tip.notify_user | ||
| 138 | 138 | ||
| 139 | 139 | Rails.logger.info " Tip created #{tip.inspect}" | |
| 140 | 140 | end | |
@@ -161,7 +161,9 @@ def tips_paid_unclaimed_amount | |||
| 161 | 161 | end | |
| 162 | 162 | ||
| 163 | 163 | def next_tip_amount | |
| 164 | - (CONFIG["tip"]*available_amount).ceil | ||
| 164 | + next_tip_amount = (CONFIG["tip"]*available_amount).ceil | ||
| 165 | + next_tip_amount = [next_tip_amount, CONFIG["min_tip"]].max if CONFIG["min_tip"] | ||
| 166 | + next_tip_amount = [next_tip_amount, available_amount].min | ||
| 165 | 167 | end | |
| 166 | 168 | ||
| 167 | 169 | def update_cache | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,6 +35,7 @@ smtp_settings: | |||
| 35 | 35 | tip: 0.01 | |
| 36 | 36 | min_payout: 100000 | |
| 37 | 37 | our_fee: 0.05 | |
| 38 | + min_tip: 50000 # optional | ||
| 38 | 39 | ||
| 39 | 40 | deposit_address: 1M4bS4gPyA6Kb8w7aXsgth9oUZWcRk73tQ | |
| 40 | 41 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + Feature: Admins can set minimum tip amount in the configuration file | ||
| 2 | + Background: | ||
| 3 | + Given a project "my-project" | ||
| 4 | + And our fee is "0" | ||
| 5 | + And min tip amount is "300" | ||
| 6 | + And a deposit of "500" | ||
| 7 | + And the last known commit is "COMMIT1" | ||
| 8 | + | ||
| 9 | + Scenario: Developer gets more than 1% of funds, but less than available_amount | ||
| 10 | + And a user "yugo" has opted-in | ||
| 11 | + And a new commit "COMMIT2" with parent "COMMIT1" | ||
| 12 | + And the author of commit "COMMIT2" is "yugo" | ||
| 13 | + And a new commit "COMMIT3" with parent "COMMIT2" | ||
| 14 | + And the author of commit "COMMIT3" is "yugo" | ||
| 15 | + When the new commits are read | ||
| 16 | + Then there should be a tip of "300" for commit "COMMIT2" | ||
| 17 | + And there should be a tip of "200" for commit "COMMIT3" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,10 @@ | |||
| 21 | 21 | CONFIG["our_fee"] = arg1.to_f | |
| 22 | 22 | end | |
| 23 | 23 | ||
| 24 | + Given(/^min tip amount is "(.*?)"$/) do |arg1| | ||
| 25 | + CONFIG["min_tip"] = arg1.to_f * 1e8 | ||
| 26 | + end | ||
| 27 | + | ||
| 24 | 28 | Given(/^a project$/) do | |
| 25 | 29 | @project = Project.create!(full_name: "example/test", github_id: 123, bitcoin_address: 'mq4NtnmQoQoPfNWEPbhSvxvncgtGo6L8WY') | |
| 26 | 30 | end | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,7 @@ Feature: A project collaborator can change the tips of commits | |||
| 7 | 7 | | seldon | | |
| 8 | 8 | | daneel | | |
| 9 | 9 | And our fee is "0" | |
| 10 | + And min tip amount is "0" | ||
| 10 | 11 | And a deposit of "500" | |
| 11 | 12 | And the last known commit is "AAA" | |
| 12 | 13 | And a new commit "BBB" with parent "AAA" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments