From 7337c1a14e845e4f798b6bc9a42890e55d23af18 Mon Sep 17 00:00:00 2001 From: Dan Lipert Date: Wed, 5 Jun 2019 22:46:44 +0900 Subject: [PATCH] set approval tx hash to sync with final subscription remove setting approve tx an extra time better subminer error for one-time subs --- app/assets/v2/js/grants/fund.js | 2 +- app/grants/management/commands/subminer.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/v2/js/grants/fund.js b/app/assets/v2/js/grants/fund.js index 1fbad71f691..1c6c30fccb6 100644 --- a/app/assets/v2/js/grants/fund.js +++ b/app/assets/v2/js/grants/fund.js @@ -198,6 +198,7 @@ $(document).ready(function() { console.log('1', error); _alert({ message: gettext('Your approval transaction failed. Please try again.')}, 'error'); }).on('transactionHash', function(transactionHash) { + $('#sub_new_approve_tx_id').val(transactionHash); if (data.num_periods == 1) { // call splitter after approval splitPayment(accounts[0], data.admin_address, gitcoinDonationAddress, Number(grant_amount * Math.pow(10, decimals)).toLocaleString('fullwide', {useGrouping: false}), Number(gitcoin_grant_amount * Math.pow(10, decimals)).toLocaleString('fullwide', {useGrouping: false})); @@ -243,7 +244,6 @@ $(document).ready(function() { const subscribeToGrant = (transactionHash) => { web3.eth.getAccounts(function(err, accounts) { deployedToken.methods.decimals().call(function(err, decimals) { - $('#sub_new_approve_tx_id').val(transactionHash); const linkURL = etherscan_tx_url(transactionHash); let token_address = $('#js-token').length ? $('#js-token').val() : $('#sub_token_address').val(); let data = { diff --git a/app/grants/management/commands/subminer.py b/app/grants/management/commands/subminer.py index e861caf9f04..1c9c758b480 100644 --- a/app/grants/management/commands/subminer.py +++ b/app/grants/management/commands/subminer.py @@ -65,6 +65,12 @@ def process_subscription(subscription, live): elif not has_approve_tx_mined: logger.info(f" -- ( NOT ready via approve tx, will be ready when {subscription.new_approve_tx_id} mines) ") else: + if subscription.contributor_signature == "onetime": + subscription.error = True + subscription.subminer_comments = "One time subscription" + subscription.save() + logger.info('skipping one time subscription: %s' % subscription.id) + return web3_hash_arguments = subscription.get_subscription_hash_arguments() if web3_hash_arguments['periodSeconds'] < METATX_FREE_INTERVAL_SECONDS and web3_hash_arguments['gasPrice'] <= METATX_GAS_PRICE_THRESHOLD: subscription.error = True