Skip to content

Commit 23a4cec

Browse files
authored
Update API.hs - test getvotes filtering with txhash+index
Signed-off-by: bosko-m <[email protected]>
1 parent bbbcc93 commit 23a4cec

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

govtool/backend/src/VVA/API.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,22 +296,22 @@ getVotes (unHexText -> dRepId) selectedTypes sortMode mSearch = do
296296
CacheEnv {dRepGetVotesCache} <- asks vvaCache
297297
(votes, proposals) <- cacheRequest dRepGetVotesCache dRepId $ DRep.getVotes dRepId []
298298

299-
let voteMapByTxHash = Map.fromList $
300-
map (\vote -> (pack $ Prelude.takeWhile (/= '#') (unpack $ Types.voteGovActionId vote), vote)) votes
299+
let voteMapById = Map.fromList $
300+
map (\vote -> (Types.voteGovActionId vote, vote)) votes
301301

302302
processedProposals <- filter (isProposalSearchedFor mSearch) <$>
303303
mapSortAndFilterProposals selectedTypes sortMode proposals
304304

305-
return $
305+
return
306306
[ VoteResponse
307307
{ voteResponseVote = voteToResponse vote
308308
, voteResponseProposal = proposalResponse
309309
}
310310
| proposalResponse <- processedProposals
311-
, let txHash = unHexText (proposalResponseTxHash proposalResponse)
312-
, Just vote <- [Map.lookup txHash voteMapByTxHash]
311+
, let govActionId = unHexText (proposalResponseTxHash proposalResponse) <> "#" <> pack (show $ proposalResponseIndex proposalResponse)
312+
, Just vote <- [Map.lookup govActionId voteMapById]
313313
]
314-
314+
315315
drepInfo :: App m => HexText -> m DRepInfoResponse
316316
drepInfo (unHexText -> dRepId) = do
317317
CacheEnv {dRepInfoCache} <- asks vvaCache

0 commit comments

Comments
 (0)