Skip to content

Commit

Permalink
feat:use api data for in-draft spending
Browse files Browse the repository at this point in the history
  • Loading branch information
maiyerlee committed Nov 27, 2024
1 parent 103ad26 commit 261d199
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/src/pages/cans/detail/Can.hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default function useCan() {
plannedFunding: CANFunding?.planned_funding,
obligatedFunding: CANFunding?.obligated_funding,
inExecutionFunding: CANFunding?.in_execution_funding,
inDraftFunding: CANFunding?.in_draft_funding,
expectedFunding: CANFunding?.expected_funding,
receivedFunding: CANFunding?.received_funding,
subTitle: can ? `${can.nick_name} - ${can.active_period} ${can.active_period > 1 ? "Years" : "Year"}` : "",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/pages/cans/detail/Can.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const Can = () => {
plannedFunding,
obligatedFunding,
inExecutionFunding,
inDraftFunding,
subTitle,
projectTypesCount,
budgetLineTypesCount,
Expand Down Expand Up @@ -87,6 +88,7 @@ const Can = () => {
budgetLineTypesCount={budgetLineTypesCount}
agreementTypesCount={testAgreements}
inExecutionFunding={inExecutionFunding}
inDraftFunding={inDraftFunding}
obligatedFunding={obligatedFunding}
plannedFunding={plannedFunding}
totalFunding={totalFunding}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/cans/detail/CanSpending.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ const CanSpending = ({
agreementTypesCount,
plannedFunding,
inExecutionFunding,
inDraftFunding,
obligatedFunding,
totalFunding
}) => {
const totalSpending = Number(plannedFunding) + Number(obligatedFunding) + Number(inExecutionFunding);
const DRAFT_FUNDING = 1_000_000; // replace with actual data

const graphData = [
{
id: 1,
label: "Draft",
value: Math.round(DRAFT_FUNDING) || 0,
value: Math.round(inDraftFunding) || 0,
color: "var(--neutral-lighter)",
percent: `${calculatePercent(DRAFT_FUNDING, totalFunding)}%`
percent: `${calculatePercent(inDraftFunding, totalFunding)}%`
},
{
id: 2,
Expand Down

0 comments on commit 261d199

Please sign in to comment.