Skip to content

Commit 9bb7527

Browse files
committed
fix(#2379): fix listing voted-on governance actions
1 parent c99bc8c commit 9bb7527

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ changes.
1616

1717
### Fixed
1818

19-
-
19+
- Fix listing voted-on governance actions [Issue 2379](https://github.com/IntersectMBO/govtool/issues/2379)
2020

2121
### Changed
2222

govtool/backend/src/VVA/DRep.hs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,21 @@ getVotes drepId selectedProposals = withPool $ \conn -> do
117117
let proposalsToSelect = if null selectedProposals
118118
then [ govActionId | (_, govActionId, _, _, _, _, _, _, _) <- results]
119119
else selectedProposals
120-
proposals <- if null proposalsToSelect
121-
then return []
122-
else Proposal.getProposals (Just proposalsToSelect)
120+
121+
allProposals <- mapM (Proposal.getProposals . Just . (:[])) proposalsToSelect
122+
123+
let proposals = concat allProposals
124+
123125
let proposalMap = M.fromList $ map (\x -> (proposalId x, x)) proposals
126+
124127
timeZone <- liftIO getCurrentTimeZone
125-
let votes = [ Vote proposalId' drepId' vote' url' docHash' epochNo' (localTimeToUTC timeZone date') voteTxHash'
126-
| (proposalId', govActionId', drepId', vote', url', docHash', epochNo', date', voteTxHash') <- results
127-
, govActionId' `elem` proposalsToSelect
128-
]
128+
129+
let votes =
130+
[ Vote proposalId' drepId' vote' url' docHash' epochNo' (localTimeToUTC timeZone date') voteTxHash'
131+
| (proposalId', govActionId', drepId', vote', url', docHash', epochNo', date', voteTxHash') <- results
132+
, govActionId' `elem` proposalsToSelect
133+
]
134+
129135
return (votes, proposals)
130136

131137
getDRepInfoSql :: SQL.Query

0 commit comments

Comments
 (0)