Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements and Fixes: Automated Voting, DRep Directory, and Workflow Adjustments #675

Merged
merged 37 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e3ae5e3
fix resolutions
Sworzen1 Apr 4, 2024
0d54491
replace ternary operator with if statement
Sworzen1 Apr 5, 2024
8e9ab20
[#216] add Automated Voting Options component
Sworzen1 Feb 27, 2024
1c4012d
[#217] add dRep directory page and nav items
j-dyczka Mar 6, 2024
dea8c29
[#217] use translations in menu items
j-dyczka Mar 8, 2024
1c44199
[#216] use Accordion from MUI to improve user experience
j-dyczka Mar 8, 2024
7a40c80
[#219] create details page for drep in drep directory
Sworzen1 Feb 28, 2024
5cf3940
[#219] reorder translations
MSzalowski Mar 1, 2024
cd93e51
[#219] fetch data for DRep details page
j-dyczka Mar 21, 2024
906e094
[#219] fetch data for DRep details page
j-dyczka Mar 21, 2024
4985a75
[#220] add styling for DRepCard in default state
j-dyczka Mar 6, 2024
3ff60d5
[#220] fetch data for drep list
j-dyczka Mar 21, 2024
742c886
[#216] add logic for automated voting options
j-dyczka Mar 22, 2024
d0650b9
[#220] changes after CR
j-dyczka Mar 27, 2024
7fc84a0
[#220] fix drep list infinite loader for unnconnected users
j-dyczka Mar 27, 2024
61b0d08
[#221] add search, filter and sort to drep list
j-dyczka Mar 26, 2024
82b1544
fix: change edit drep navigation path
MSzalowski Apr 5, 2024
c410b35
Merge pull request #639 from IntersectMBO/feat/99-drep-directory
MSzalowski Apr 5, 2024
8f7ed22
[#545] change footer component
Sworzen1 Apr 5, 2024
aff3fa2
Merge pull request #625 from IntersectMBO/fix/532-home-page-on-2560-a…
Sworzen1 Apr 5, 2024
d1aed81
Merge branch 'develop' of https://github.com/IntersectMBO/govtool int…
Sworzen1 Apr 5, 2024
8ddd302
[#545] add footer to drep directory
Sworzen1 Apr 5, 2024
bbaee21
bugfix: change dispatch condition on deployment workflows
MSzalowski Apr 5, 2024
f585328
Merge pull request #645 from IntersectMBO/bugfix/change-dispatch-on-c…
placek Apr 8, 2024
82c80b6
[#617] feat: integrate frontend with metadata validation service
MSzalowski Apr 3, 2024
7f439dc
Merge pull request #619 from IntersectMBO/feat/617-integrate-frontend…
MSzalowski Apr 8, 2024
9cdd397
Merge pull request #642 from IntersectMBO/chore/545-create-shared-foo…
Sworzen1 Apr 8, 2024
fe2146f
[#641] fix sole voter card
Sworzen1 Apr 8, 2024
8426b3d
[#627] add latestTxHash to drep/list and drep/info endpoints
jankun4 Apr 7, 2024
e813b7b
[#626] add to endpoint
jankun4 Apr 7, 2024
7afb1d7
[#641] fix lint
Sworzen1 Apr 8, 2024
eff5118
[#646] feat: implement a loading modal for the metadata validation
MSzalowski Apr 8, 2024
a2487d1
Merge pull request #670 from IntersectMBO/fix/641-dashboard-sole-volt…
Sworzen1 Apr 8, 2024
3a1cf02
Merge pull request #672 from IntersectMBO/feat/646-implement-a-loadin…
MSzalowski Apr 9, 2024
e9cdbea
[#636] add references to all proposal related endpoints
jankun4 Apr 7, 2024
851201f
[#676] fix drep/info SQL error
jankun4 Apr 9, 2024
5eeb63f
Merge pull request #677 from IntersectMBO/676-error-500-when-requesti…
MSzalowski Apr 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/build-and-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: Build and deploy GovTool to STAGING server
run-name: Deploy by @${{ github.actor }}

on:
pull_request:
push:
branches:
- staging
types:
- closed

env:
ENVIRONMENT: "staging"
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: Build and deploy GovTool to TEST server
run-name: Deploy by @${{ github.actor }}

on:
pull_request:
push:
branches:
- test
types:
- closed

env:
ENVIRONMENT: "test"
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ jobs:
- name: Run build and lighthouse task
working-directory: ./govtool/frontend
run: |
npm install
VITE_BASE_URL=https://staging.govtool.byron.network/api npm run build
lhci collect
npm install
VITE_BASE_URL=https://staging.govtool.byron.network/ npm run build
lhci collect

- name: Evaluate reports
if: github.repository_owner != 'IntersectMBO'
run: |
lhci assert --preset "lighthouse:recommended"
lhci assert --preset "lighthouse:recommended"

- name: Publish reports
working-directory: ./govtool/frontend
if: github.repository_owner == 'IntersectMBO'
run: |
lhci assert --preset lighthouse:recommended || echo "LightHouse Assertion error ignored ..."
lhci upload --githubAppToken="${{ secrets.LHCI_GITHUB_APP_TOKEN }}" --token="${{ secrets.LHCI_SERVER_TOKEN }}" --serverBaseUrl=https://lighthouse.cardanoapi.io --ignoreDuplicateBuildFailure
curl -X POST https://ligththouse.cardanoapi.io/api/metrics/build-reports \
-d "@./lighthouseci/$(ls ./.lighthouseci |grep 'lhr.*\.json' | head -n 1)" \
-H "commit-hash: $(git rev-parse HEAD)" \
-H "secret-token: ${{ secrets.METRICS_SERVER_SECRET_TOKEN }}" \
-H 'Content-Type: application/json' || echo "Metric Upload error ignored ..."
lhci assert --preset lighthouse:recommended || echo "LightHouse Assertion error ignored ..."
lhci upload --githubAppToken="${{ secrets.LHCI_GITHUB_APP_TOKEN }}" --token="${{ secrets.LHCI_SERVER_TOKEN }}" --serverBaseUrl=https://lighthouse.cardanoapi.io --ignoreDuplicateBuildFailure
curl -X POST https://ligththouse.cardanoapi.io/api/metrics/build-reports \
-d "@./lighthouseci/$(ls ./.lighthouseci |grep 'lhr.*\.json' | head -n 1)" \
-H "commit-hash: $(git rev-parse HEAD)" \
-H "secret-token: ${{ secrets.METRICS_SERVER_SECRET_TOKEN }}" \
-H 'Content-Type: application/json' || echo "Metric Upload error ignored ..."
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@ changes.

## [Unreleased]

- Integrate frontend with metadata validation service [Issue 617](https://github.com/IntersectMBO/govtool/issues/617)
- Implement a loading modal for the validation of the metadata [Issue 646](https://github.com/IntersectMBO/govtool/issues/646)

### Added

- addded latestTxHash to the `drep/info` and `drep/list` endpoints [Issue 627](https://github.com/IntersectMBO/govtool/issues/627)
- added `txHash` to `drep/getVotes` [Issue 626](https://github.com/IntersectMBO/govtool/issues/626)
- added `references` to all proposal related endpoints
- added `epochNo` and `date` to `drep/getVotes` and `proposal/get`
- Added `isRegisteredAsSoleVoter` and `wasRegisteredAsSoleVoter` fields to the drep/info response [Issue 212](https://github.com/IntersectMBO/govtool/issues/212)
- Abandoning registration as DRep [Issue 151](https://github.com/IntersectMBO/govtool/issues/151)
- Abandoning GA creation [Issue 359](https://github.com/IntersectMBO/govtool/issues/359)
- Choose GA type - GA Submiter [Issue 358](https://github.com/IntersectMBO/govtool/issues/358)
- Create Automated Voting Options component [Issue 216](https://github.com/IntersectMBO/govtool/issues/216)
- Change step 3 components [Issue 152](https://github.com/intersectMBO/govtool/issues/152)
- Add possibility to vote on behalf of myself - Sole Voter [Issue 119](https://github.com/IntersectMBO/govtool/issues/119)
- Create DRep registration page about roles [Issue 205](https://github.com/IntersectMBO/govtool/issues/205)
- Create Checkbox component. Improve Field and ControlledField [Issue 177](https://github.com/IntersectMBO/govtool/pull/177)
- Vitest unit tests added for utils functions [Issue 81](https://github.com/IntersectMBO/govtool/issues/81)
Expand All @@ -38,6 +48,7 @@ changes.

### Fixed

- drep/info no longer returns 500 [Issue 676](https://github.com/IntersectMBO/govtool/issues/676)
- proposal/list search is case insensitive now [Issue 582](https://github.com/IntersectMBO/govtool/issues/582)
- proposal/list now takes optional `search` query param [Issue 566](https://github.com/IntersectMBO/govtool/issues/566)
- Fix possible sql error when there would be no predefined drep voting pwoer [Issue 501](https://github.com/IntersectMBO/govtool/issues/501)
Expand Down
8 changes: 6 additions & 2 deletions govtool/backend/sql/get-drep-info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ WITH DRepId AS (
LatestRegistrationEntry AS (
SELECT
drep_registration.voting_anchor_id AS voting_anchor_id,
deposit AS deposit
drep_registration.deposit AS deposit,
tx.hash as tx_hash
FROM
drep_registration
CROSS JOIN DrepId
JOIN drep_hash ON drep_hash.id = drep_registration.drep_hash_id
JOIN tx ON tx.id = drep_registration.tx_id
WHERE
drep_hash.raw = DRepId.raw
ORDER BY
Expand Down Expand Up @@ -95,7 +97,8 @@ SELECT
CurrentDeposit.value,
CurrentMetadata.url,
CurrentMetadata.data_hash,
CurrentVotingPower.amount
CurrentVotingPower.amount,
encode(LatestRegistrationEntry.tx_hash, 'hex') as tx_hash
FROM
IsRegisteredAsDRep
CROSS JOIN IsRegisteredAsSoleVoter
Expand All @@ -104,3 +107,4 @@ FROM
CROSS JOIN CurrentDeposit
CROSS JOIN CurrentMetadata
CROSS JOIN CurrentVotingPower
CROSS JOIN LatestRegistrationEntry
11 changes: 6 additions & 5 deletions govtool/backend/sql/get-votes.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
select DISTINCT ON (voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter) voting_procedure.gov_action_proposal_id, concat(encode(tx.hash,'hex'),'#',gov_action_proposal.index), encode(drep_hash.raw, 'hex'), voting_procedure.vote::text, voting_anchor.url, encode(voting_anchor.data_hash, 'hex'), block.epoch_no as epoch_no, block.time as time
from voting_procedure
select DISTINCT ON (voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter) voting_procedure.gov_action_proposal_id, concat(encode(gov_action_tx.hash,'hex'),'#',gov_action_proposal.index), encode(drep_hash.raw, 'hex'), voting_procedure.vote::text, voting_anchor.url, encode(voting_anchor.data_hash, 'hex'), block.epoch_no as epoch_no, block.time as time, encode(vote_tx.hash, 'hex') as vote_tx_hash
join gov_action_proposal
on gov_action_proposal.id = voting_procedure.gov_action_proposal_id
join drep_hash
on drep_hash.id = voting_procedure.drep_voter
left join voting_anchor
on voting_anchor.id = voting_procedure.voting_anchor_id
join tx
on tx.id = gov_action_proposal.tx_id
join tx as gov_action_tx
on gov_action_tx.id = gov_action_proposal.tx_id
join tx as vote_tx
on vote_tx.id = voting_procedure.tx_id
join block
on block.id = tx.block_id
on block.id = gov_action_tx.block_id
where drep_hash.raw = decode(?, 'hex')
order by voting_procedure.gov_action_proposal_id, voting_procedure.drep_voter, voting_procedure.id desc
9 changes: 6 additions & 3 deletions govtool/backend/sql/list-dreps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ SELECT
dr_deposit.deposit,
DRepDistr.amount,
(DRepActivity.epoch_no - Max(coalesce(block.epoch_no,block_first_register.epoch_no))) <= DRepActivity.drep_activity as active,
second_to_newest_drep_registration.voting_anchor_id is not null as has_voting_anchor
second_to_newest_drep_registration.voting_anchor_id is not null as has_voting_anchor,
encode(dr_voting_anchor.tx_hash, 'hex') as tx_hash
FROM drep_hash dh
JOIN (
SELECT dr.id, dr.drep_hash_id, dr.deposit,
Expand All @@ -34,8 +35,10 @@ JOIN (
on dr_deposit.drep_hash_id = dh.id and dr_deposit.rn = 1
LEFT JOIN (
SELECT dr.id, dr.drep_hash_id, dr.voting_anchor_id,
ROW_NUMBER() OVER(PARTITION BY dr.drep_hash_id ORDER BY dr.tx_id DESC) AS rn
ROW_NUMBER() OVER(PARTITION BY dr.drep_hash_id ORDER BY dr.tx_id DESC) AS rn,
tx.hash as tx_hash
FROM drep_registration dr
JOIN tx on tx.id = dr.tx_id
) as dr_voting_anchor
on dr_voting_anchor.drep_hash_id = dh.id and dr_voting_anchor.rn = 1
LEFT JOIN (
Expand Down Expand Up @@ -65,4 +68,4 @@ on tx_first_register.id = dr_first_register.tx_id
JOIN block as block_first_register
ON block_first_register.id = tx_first_register.block_id

GROUP BY dh.raw, second_to_newest_drep_registration.voting_anchor_id, dh.view, va.url, va.data_hash, dr_deposit.deposit, DRepDistr.amount, DRepActivity.epoch_no, DRepActivity.drep_activity
GROUP BY dh.raw, second_to_newest_drep_registration.voting_anchor_id, dh.view, va.url, va.data_hash, dr_deposit.deposit, DRepDistr.amount, DRepActivity.epoch_no, DRepActivity.drep_activity, dr_voting_anchor.tx_hash
1 change: 1 addition & 0 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ SELECT
off_chain_vote_data.motivation,
off_chain_vote_data.rationale,
off_chain_vote_data.json,
off_chain_vote_data.json#>'{body, references}' as references,
coalesce(Sum(ldd.amount) FILTER (WHERE voting_procedure.vote::text = 'Yes'), 0) +(
CASE WHEN gov_action_proposal.type = 'NoConfidence' THEN
always_no_confidence_voting_power.amount
Expand Down
8 changes: 6 additions & 2 deletions govtool/backend/src/VVA/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ drepRegistrationToDrep Types.DRepRegistration {..} =
dRepDeposit = dRepRegistrationDeposit,
dRepVotingPower = dRepRegistrationVotingPower,
dRepStatus = mapDRepStatus dRepRegistrationStatus,
dRepType = mapDRepType dRepRegistrationType
dRepType = mapDRepType dRepRegistrationType,
dRepLatestTxHash = HexText <$> dRepRegistrationLatestTxHash
}

drepList :: App m => Maybe Text -> m [DRep]
Expand Down Expand Up @@ -137,6 +138,7 @@ proposalToResponse Types.Proposal {..} =
proposalResponseMotivation = proposalMotivaiton,
proposalResponseRationale = proposalRationale,
proposalResponseMetadata = GovernanceActionMetadata <$> proposalMetadata,
proposalResponseReferences = GovernanceActionReferences <$> proposalReferences,
proposalResponseYesVotes = proposalYesVotes,
proposalResponseNoVotes = proposalNoVotes,
proposalResponseAbstainVotes = proposalAbstainVotes
Expand All @@ -151,7 +153,8 @@ voteToResponse Types.Vote {..} =
voteParamsUrl = voteUrl,
voteParamsMetadataHash = HexText <$> voteDocHash,
voteParamsEpochNo = voteEpochNo,
voteParamsDate = voteDate
voteParamsDate = voteDate,
voteParamsTxHash = HexText voteTxHash
}


Expand Down Expand Up @@ -208,6 +211,7 @@ drepInfo (unHexText -> dRepId) = do
, dRepInfoResponseUrl = dRepInfoUrl
, dRepInfoResponseDataHash = HexText <$> dRepInfoDataHash
, dRepInfoResponseVotingPower = dRepInfoVotingPower
, dRepInfoResponseLatestTxHash = HexText <$> dRepInfoLatestTxHash
}

getCurrentDelegation :: App m => HexText -> m (Maybe HexText)
Expand Down
49 changes: 39 additions & 10 deletions govtool/backend/src/VVA/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,27 @@ instance ToSchema GovernanceActionMetadata where



newtype GovernanceActionReferences
= GovernanceActionReferences Value
deriving newtype (Show)

instance FromJSON GovernanceActionReferences where
parseJSON v@(Aeson.Array a) = pure (GovernanceActionReferences v)
parseJSON _ = fail "GovernanceActionReferences has to be an array"

instance ToJSON GovernanceActionReferences where
toJSON (GovernanceActionReferences g) = g

instance ToSchema GovernanceActionReferences where
declareNamedSchema _ = pure $ NamedSchema (Just "GovernanceActionReferences") $ mempty
& type_ ?~ OpenApiObject
& description ?~ "A Governance Action References"
& example
?~ toJSON
("[{\"uri\": \"google.com\", \"@type\": \"Other\", \"label\": \"example label\"}]" :: Text)



data ProposalResponse
= ProposalResponse
{ proposalResponseId :: Text
Expand All @@ -285,6 +306,7 @@ data ProposalResponse
, proposalResponseMotivation :: Maybe Text
, proposalResponseRationale :: Maybe Text
, proposalResponseMetadata :: Maybe GovernanceActionMetadata
, proposalResponseReferences :: Maybe GovernanceActionReferences
, proposalResponseYesVotes :: Integer
, proposalResponseNoVotes :: Integer
, proposalResponseAbstainVotes :: Integer
Expand All @@ -310,6 +332,7 @@ exampleProposalResponse = "{ \"id\": \"proposalId123\","
<> "\"motivation\": \"Proposal Motivation\","
<> "\"rationale\": \"Proposal Rationale\","
<> "\"metadata\": {\"key\": \"value\"},"
<> "\"references\": [{\"uri\": \"google.com\", \"@type\": \"Other\", \"label\": \"example label\"}],"
<> "\"yesVotes\": 0,"
<> "\"noVotes\": 0,"
<> "\"abstainVotes\": 0}"
Expand Down Expand Up @@ -372,6 +395,7 @@ data VoteParams
, voteParamsMetadataHash :: Maybe HexText
, voteParamsEpochNo :: Integer
, voteParamsDate :: UTCTime
, voteParamsTxHash :: HexText
}
deriving (Generic, Show)

Expand All @@ -385,7 +409,8 @@ exampleVoteParams =
<> "\"url\": \"https://vote.metadata.xyz\","
<> "\"metadataHash\": \"9af10e89979e51b8cdc827c963124a1ef4920d1253eef34a1d5cfe76438e3f11\","
<> "\"epochNo\": 0,"
<> "\"date\": \"1970-01-01T00:00:00Z\"}"
<> "\"date\": \"1970-01-01T00:00:00Z\","
<> "\"txHash\": \"47c14a128cd024f1b990c839d67720825921ad87ed875def42641ddd2169b39c\"}"

instance ToSchema VoteParams where
declareNamedSchema proxy = do
Expand Down Expand Up @@ -441,6 +466,7 @@ data DRepInfoResponse
, dRepInfoResponseUrl :: Maybe Text
, dRepInfoResponseDataHash :: Maybe HexText
, dRepInfoResponseVotingPower :: Maybe Integer
, dRepInfoResponseLatestTxHash :: Maybe HexText
}
deriving (Generic, Show)

Expand All @@ -455,7 +481,8 @@ exampleDRepInfoResponse =
<> "\"deposit\": 2000000,"
<> "\"url\": \"https://drep.metadata.xyz\","
<> "\"dataHash\": \"9af10e89979e51b8cdc827c963124a1ef4920d1253eef34a1d5cfe76438e3f11\","
<> "\"votingPower\": 1000000}"
<> "\"votingPower\": 1000000,"
<> "\"latestTxHash\": \"47c14a128cd024f1b990c839d67720825921ad87ed875def42641ddd2169b39c\"}"

instance ToSchema DRepInfoResponse where
declareNamedSchema proxy = do
Expand Down Expand Up @@ -632,6 +659,7 @@ data DRep
, dRepVotingPower :: Maybe Integer
, dRepStatus :: DRepStatus
, dRepType :: DRepType
, dRepLatestTxHash :: Maybe HexText
}
deriving (Generic, Show)

Expand All @@ -640,14 +668,15 @@ deriveJSON (jsonOptions "dRep") ''DRep

exampleDrep :: Text
exampleDrep =
"{\"drepId\": \"d3a62ffe9c214e1a6a9809f7ab2a104c117f85e1f171f8f839d94be5\","
<> "\"view\": \"drep1l8uyy66sm8u82h82gc8hkcy2xu24dl8ffsh58aa0v7d37yp48u8\","
<> "\"url\": \"https://proposal.metadata.xyz\","
<> "\"metadataHash\": \"9af10e89979e51b8cdc827c963124a1ef4920d1253eef34a1d5cfe76438e3f11\","
<> "\"deposit\": 0,"
<> "\"votingPower\": 0,"
<> "\"status\": \"Active\","
<> "\"type\": \"DRep\"}"
"{\"drepId\": \"d3a62ffe9c214e1a6a9809f7ab2a104c117f85e1f171f8f839d94be5\","
<> "\"view\": \"drep1l8uyy66sm8u82h82gc8hkcy2xu24dl8ffsh58aa0v7d37yp48u8\","
<> "\"url\": \"https://proposal.metadata.xyz\","
<> "\"metadataHash\": \"9af10e89979e51b8cdc827c963124a1ef4920d1253eef34a1d5cfe76438e3f11\","
<> "\"deposit\": 0,"
<> "\"votingPower\": 0,"
<> "\"status\": \"Active\","
<> "\"type\": \"DRep\","
<> "\"latestTxHash\": \"47c14a128cd024f1b990c839d67720825921ad87ed875def42641ddd2169b39c\"}"

-- ToSchema instance for DRep
instance ToSchema DRep where
Expand Down
14 changes: 8 additions & 6 deletions govtool/backend/src/VVA/DRep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ listDReps ::
listDReps = withPool $ \conn -> do
results <- liftIO $ SQL.query_ conn listDRepsSql
return
[ DRepRegistration drepHash drepView url dataHash (floor @Scientific deposit) votingPower status drepType
| (drepHash, drepView, url, dataHash, deposit, votingPower, isActive, wasDRep) <- results
[ DRepRegistration drepHash drepView url dataHash (floor @Scientific deposit) votingPower status drepType txHash
| (drepHash, drepView, url, dataHash, deposit, votingPower, isActive, wasDRep, txHash) <- results
, let status = case (isActive, deposit) of
(_, d) | d < 0 -> Retired
(isActive, d) | d >= 0 && isActive -> Active
Expand All @@ -82,14 +82,14 @@ getVotes ::
getVotes drepId selectedProposals = withPool $ \conn -> do
results <- liftIO $ SQL.query conn getVotesSql (SQL.Only drepId)
let proposalsToSelect = if null selectedProposals
then [ govActionId | (_, govActionId, _, _, _, _, _, _) <- results]
then [ govActionId | (_, govActionId, _, _, _, _, _, _, _) <- results]
else selectedProposals
proposals <- Proposal.getProposals (Just proposalsToSelect)
let proposalMap = M.fromList $ map (\x -> (proposalId x, x)) proposals
timeZone <- liftIO getCurrentTimeZone
return
([ Vote proposalId' drepId' vote' url' docHash' epochNo' (localTimeToUTC timeZone date')
| (proposalId', govActionId', drepId', vote', url', docHash', epochNo', date') <- results
([ Vote proposalId' drepId' vote' url' docHash' epochNo' (localTimeToUTC timeZone date') voteTxHash'
| (proposalId', govActionId', drepId', vote', url', docHash', epochNo', date', voteTxHash') <- results
, govActionId' `elem` proposalsToSelect
], proposals)

Expand Down Expand Up @@ -117,6 +117,7 @@ getDRepInfo drepId = withPool $ \conn -> do
, url
, dataHash
, votingPower
, txHash
)] ->
return $ DRepInfo
{ dRepInfoIsRegisteredAsDRep = fromMaybe False isRegisteredAsDRep
Expand All @@ -127,5 +128,6 @@ getDRepInfo drepId = withPool $ \conn -> do
, dRepInfoUrl = url
, dRepInfoDataHash = dataHash
, dRepInfoVotingPower = votingPower
, dRepInfoLatestTxHash = Just txHash
}
[] -> return $ DRepInfo False False False False Nothing Nothing Nothing Nothing
[] -> return $ DRepInfo False False False False Nothing Nothing Nothing Nothing Nothing
2 changes: 2 additions & 0 deletions govtool/backend/src/VVA/Proposal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ getProposals mProposalIds = withPool $ \conn -> do
, motivation'
, rationale'
, metadataJson'
, references'
, yesVotes'
, noVotes'
, abstainVotes'
Expand All @@ -111,6 +112,7 @@ getProposals mProposalIds = withPool $ \conn -> do
motivation'
rationale'
metadataJson'
references'
(floor @Scientific yesVotes')
(floor @Scientific noVotes')
(floor @Scientific abstainVotes')
Expand Down
Loading
Loading