Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update can_submit_after_expiration_date #856

Merged
merged 2 commits into from
Apr 11, 2018
Merged
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
15 changes: 14 additions & 1 deletion app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
# legacy bounties could submit after expirration date
return True

# standardbounties
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
def title_or_desc(self):
Expand Down
11 changes: 7 additions & 4 deletions app/dashboard/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down