From 5196d28c6c7b5392a347947eb8ba245f0a90d30a Mon Sep 17 00:00:00 2001 From: Owocki Date: Tue, 10 Apr 2018 08:34:18 -0600 Subject: [PATCH 1/2] https://github.com/gitcoinco/web/issues/855 --- app/dashboard/models.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 283fca29ac7..68d2ee85773 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -207,7 +207,20 @@ def url(self): @property def can_submit_after_expiration_date(self): - return self.is_legacy or self.raw_data.get('payload', {}).get('expire_date', False) + if self.is_legacy: + return True # legacy bounties could submit after expirration date + + # standardbounties + payload_expiration_date = self.raw_data.get('data', {}).get('payload', {}).get('expire_date', False) + if not payload_expiration_date: + return False # if theres no expiry date in the payload, then expiration date is not mocked, and one cannot submit after expiration date + + contract_expiration_date = self.expires_date.timestamp() + delta_between_contract_and_payload_expiration_dates = abs(int(contract_expiration_date) - int(payload_expiration_date)) + expected_delta_if_mocked = 25200 + print(delta_between_contract_and_payload_expiration_dates) + return delta_between_contract_and_payload_expiration_dates > expected_delta_if_mocked + @property def title_or_desc(self): From 4dbd451f17dab2097455c65ffb10803090e826b7 Mon Sep 17 00:00:00 2001 From: Owocki Date: Tue, 10 Apr 2018 09:08:49 -0600 Subject: [PATCH 2/2] finally got it --- app/dashboard/models.py | 20 ++++++++++---------- app/dashboard/utils.py | 11 +++++++---- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 68d2ee85773..c9f51a5b99e 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -208,18 +208,18 @@ def url(self): @property def can_submit_after_expiration_date(self): if self.is_legacy: - return True # legacy bounties could submit after expirration date + # legacy bounties could submit after expirration date + return True # standardbounties - payload_expiration_date = self.raw_data.get('data', {}).get('payload', {}).get('expire_date', False) - if not payload_expiration_date: - return False # if theres no expiry date in the payload, then expiration date is not mocked, and one cannot submit after expiration date - - contract_expiration_date = self.expires_date.timestamp() - delta_between_contract_and_payload_expiration_dates = abs(int(contract_expiration_date) - int(payload_expiration_date)) - expected_delta_if_mocked = 25200 - print(delta_between_contract_and_payload_expiration_dates) - return delta_between_contract_and_payload_expiration_dates > expected_delta_if_mocked + contract_deadline = self.raw_data.get('contract_deadline', False) + ipfs_deadline = self.raw_data.get('ipfs_deadline', False) + if not ipfs_deadline: + # if theres no expiry date in the payload, then expiration date is not mocked, and one cannot submit after expiration date + return False + + # if contract_deadline > ipfs_deadline, then by definition, can be submitted after expiry date + return contract_deadline > ipfs_deadline @property diff --git a/app/dashboard/utils.py b/app/dashboard/utils.py index 610b6c07e16..8e0c1d99f2f 100644 --- a/app/dashboard/utils.py +++ b/app/dashboard/utils.py @@ -136,7 +136,7 @@ def get_bounty(bounty_enum, network): standard_bounties = getBountyContract(network) try: - issuer, deadline, fulfillmentAmount, paysTokens, bountyStage, balance = standard_bounties.functions.getBounty(bounty_enum).call() + issuer, contract_deadline, fulfillmentAmount, paysTokens, bountyStage, balance = standard_bounties.functions.getBounty(bounty_enum).call() except BadFunctionCallOutput: raise BountyNotFoundException @@ -173,15 +173,18 @@ def get_bounty(bounty_enum, network): raise IPFSCantConnectException("Failed to connect to IPFS") # https://github.com/Bounties-Network/StandardBounties/issues/25 - override_deadline = bounty_data.get('payload', {}).get('expire_date', False) - if override_deadline: - deadline = override_deadline + ipfs_deadline = bounty_data.get('payload', {}).get('expire_date', False) + deadline = contract_deadline + if ipfs_deadline: + deadline = ipfs_deadline # assemble the data bounty = { 'id': bounty_enum, 'issuer': issuer, 'deadline': deadline, + 'contract_deadline': contract_deadline, + 'ipfs_deadline': ipfs_deadline, 'fulfillmentAmount': fulfillmentAmount, 'paysTokens': paysTokens, 'bountyStage': bountyStage,