diff --git a/packages/berlin/src/pages/Results.tsx b/packages/berlin/src/pages/Results.tsx index b449fbbc..8bcaae59 100644 --- a/packages/berlin/src/pages/Results.tsx +++ b/packages/berlin/src/pages/Results.tsx @@ -1,4 +1,4 @@ -import { fetchCycle, fetchForumQuestionStatistics } from 'api'; +import { fetchCycle, fetchForumQuestionFunding, fetchForumQuestionStatistics } from 'api'; import { FlexColumn } from '../components/containers/FlexColumn.styled'; import { Subtitle } from '../components/typography/Subtitle.styled'; import { useParams } from 'react-router-dom'; @@ -9,6 +9,7 @@ import ResultsColumns from '../components/columns/results-columns'; import ResultsTable from '../components/tables/results-table'; import StatsTable from '../components/tables/stats-table'; import StatsColumns from '../components/columns/stats-columns'; +import { FINAL_QUESTION_TITLE } from '../utils/constants'; function Results() { const [expandedIndex, setExpandedIndex] = useState(null); @@ -29,6 +30,12 @@ function Results() { retry: false, }); + const { data: funding } = useQuery({ + queryKey: ['funding', cycle?.forumQuestions[0].id], + queryFn: () => fetchForumQuestionFunding(cycle?.forumQuestions[0].id || ''), + enabled: !!cycle?.id && cycle?.forumQuestions?.[0].questionTitle === FINAL_QUESTION_TITLE, + }); + const overallStatistics = [ { id: 0, @@ -56,15 +63,18 @@ function Results() { .map(([id, stats]) => ({ id, ...stats, + allocatedFunding: funding?.allocated_funding[id] || null, })) .sort((a, b) => parseFloat(b.pluralityScore) - parseFloat(a.pluralityScore)); + console.log('optionStatsArray:', optionStatsArray); + return ( Results for: {cycle?.forumQuestions?.[0].questionTitle} - + {optionStatsArray.map((option, index) => (