Merge branch 'develop' into proposal-and-comment-pagination
This commit is contained in:
commit
edc5ce54d4
|
@ -419,6 +419,8 @@ class Proposal(db.Model):
|
|||
self.date_published = datetime.datetime.now()
|
||||
self.status = ProposalStatus.LIVE
|
||||
self.stage = ProposalStage.FUNDING_REQUIRED
|
||||
# If we had a bounty that pushed us into funding, skip straight into WIP
|
||||
self.set_funded_when_ready()
|
||||
|
||||
def set_funded_when_ready(self):
|
||||
if self.status == ProposalStatus.LIVE and self.is_funded:
|
||||
|
@ -464,6 +466,9 @@ class Proposal(db.Model):
|
|||
target = Decimal(self.target)
|
||||
# apply matching multiplier
|
||||
funded = Decimal(self.contributed) * Decimal(1 + self.contribution_matching)
|
||||
# apply bounty, if available
|
||||
if self.rfp:
|
||||
funded = funded + Decimal(self.rfp.bounty)
|
||||
# if funded > target, just set as target
|
||||
if funded > target:
|
||||
return str(target)
|
||||
|
|
|
@ -61,6 +61,14 @@ export class ProposalCampaignBlock extends React.Component<Props, State> {
|
|||
const isDisabled = isFundingOver || !!amountError || !amountFloat || isPreview;
|
||||
const remainingTargetNum = parseFloat(fromZat(target.sub(funded)));
|
||||
|
||||
// Get bounty from RFP. If it exceeds proposal target, show bounty as full amount
|
||||
let bounty;
|
||||
if (proposal.rfp && proposal.rfp.bounty) {
|
||||
bounty = proposal.rfp.bounty.gt(proposal.target)
|
||||
? proposal.target
|
||||
: proposal.rfp.bounty;
|
||||
}
|
||||
|
||||
content = (
|
||||
<React.Fragment>
|
||||
{isLive && (
|
||||
|
@ -96,6 +104,12 @@ export class ProposalCampaignBlock extends React.Component<Props, State> {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{bounty && (
|
||||
<div className="ProposalCampaignBlock-bounty">
|
||||
Awarded with <UnitDisplay value={bounty} symbol="ZEC" /> bounty
|
||||
</div>
|
||||
)}
|
||||
|
||||
{proposal.contributionMatching > 0 && (
|
||||
<div className="ProposalCampaignBlock-matching">
|
||||
<span>Funds are being matched x{proposal.contributionMatching + 1}</span>
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
&-bounty,
|
||||
&-matching {
|
||||
margin: 0.5rem -1.5rem;
|
||||
padding: 0.75rem 1.5rem;
|
||||
padding: 0.75rem 1rem;
|
||||
text-align: center;
|
||||
background: @info-color;
|
||||
color: #FFF;
|
||||
font-size: 1rem;
|
||||
|
||||
|
@ -45,6 +45,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
&-bounty {
|
||||
background: @primary-color;
|
||||
}
|
||||
|
||||
&-matching {
|
||||
background: @info-color;
|
||||
}
|
||||
|
||||
&-bounty + &-matching {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
||||
&-popover {
|
||||
&-overlay {
|
||||
max-width: 400px;
|
||||
|
|
|
@ -97,6 +97,9 @@ export function formatProposalFromGet(p: any): Proposal {
|
|||
proposal.milestones = proposal.milestones.map(msToFe);
|
||||
proposal.currentMilestone = msToFe(proposal.currentMilestone);
|
||||
}
|
||||
if (proposal.rfp) {
|
||||
proposal.rfp = formatRFPFromGet(proposal.rfp);
|
||||
}
|
||||
return proposal;
|
||||
}
|
||||
|
||||
|
@ -104,7 +107,9 @@ export function formatRFPFromGet(rfp: RFP): RFP {
|
|||
if (rfp.bounty) {
|
||||
rfp.bounty = toZat(rfp.bounty as any);
|
||||
}
|
||||
if (rfp.acceptedProposals) {
|
||||
rfp.acceptedProposals = rfp.acceptedProposals.map(formatProposalFromGet);
|
||||
}
|
||||
return rfp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue