diff --git a/govtool/backend/example-config.json b/govtool/backend/example-config.json index 4960416a5..463fdc7df 100644 --- a/govtool/backend/example-config.json +++ b/govtool/backend/example-config.json @@ -3,7 +3,7 @@ "host" : "localhost", "dbname" : "cexplorer", "user" : "postgres", - "password" : "v8hlDV0yMAHHlIurYupj", + "password" : "postgres", "port" : 5432 }, "port" : 9999, diff --git a/govtool/backend/sql/list-proposals.sql b/govtool/backend/sql/list-proposals.sql index 2433b5990..dbebc2a73 100644 --- a/govtool/backend/sql/list-proposals.sql +++ b/govtool/backend/sql/list-proposals.sql @@ -59,8 +59,6 @@ SELECT off_chain_vote_gov_action_data.abstract, off_chain_vote_gov_action_data.motivation, off_chain_vote_gov_action_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 diff --git a/govtool/backend/src/VVA/API.hs b/govtool/backend/src/VVA/API.hs index f78ea1e23..702af1b77 100644 --- a/govtool/backend/src/VVA/API.hs +++ b/govtool/backend/src/VVA/API.hs @@ -13,14 +13,16 @@ import Control.Exception (throw, throwIO) import Control.Monad.Except (runExceptT, throwError) import Control.Monad.Reader -import Data.Aeson (Result (Error, Success), fromJSON, Value) +import Data.Aeson (Value(..), Array, decode, encode, FromJSON, ToJSON) import Data.Bool (Bool) import Data.List (sortOn) import qualified Data.Map as Map -import Data.Maybe (Maybe (Nothing), catMaybes, fromMaybe) +import Data.Maybe (Maybe (Nothing), catMaybes, fromMaybe, mapMaybe) import Data.Ord (Down (..)) import Data.Text hiding (any, drop, elem, filter, length, map, null, take) import qualified Data.Text as Text +import qualified Data.Vector as V + import Numeric.Natural (Natural) @@ -177,12 +179,6 @@ getVotingPower (unHexText -> dRepId) = do CacheEnv {dRepVotingPowerCache} <- asks vvaCache cacheRequest dRepVotingPowerCache dRepId $ DRep.getVotingPower dRepId -decodeReferences :: Maybe Value -> Maybe [Text] -decodeReferences Nothing = Nothing -decodeReferences (Just val) = case fromJSON val of - Success texts -> Just texts - Error _ -> Nothing - proposalToResponse :: Types.Proposal -> ProposalResponse proposalToResponse Types.Proposal {..} = ProposalResponse @@ -201,7 +197,6 @@ proposalToResponse Types.Proposal {..} = proposalResponseAbstract = proposalAbstract, proposalResponseMotivation = proposalMotivation, proposalResponseRationale = proposalRationale, - proposalResponseReferences = fromMaybe [] (decodeReferences proposalReferences), proposalResponseYesVotes = proposalYesVotes, proposalResponseNoVotes = proposalNoVotes, proposalResponseAbstainVotes = proposalAbstainVotes diff --git a/govtool/backend/src/VVA/API/Types.hs b/govtool/backend/src/VVA/API/Types.hs index ecd44a665..a2c410d66 100644 --- a/govtool/backend/src/VVA/API/Types.hs +++ b/govtool/backend/src/VVA/API/Types.hs @@ -454,7 +454,6 @@ data ProposalResponse , proposalResponseAbstract :: Maybe Text , proposalResponseMotivation :: Maybe Text , proposalResponseRationale :: Maybe Text - , proposalResponseReferences :: [Text] , proposalResponseYesVotes :: Integer , proposalResponseNoVotes :: Integer , proposalResponseAbstainVotes :: Integer @@ -479,7 +478,6 @@ exampleProposalResponse = "{ \"id\": \"proposalId123\"," <> "\"abstract\": \"Proposal About\"," <> "\"motivation\": \"Proposal Motivation\"," <> "\"rationale\": \"Proposal Rationale\"," - <> "\"references\": [\"google.com\"]," <> "\"yesVotes\": 0," <> "\"noVotes\": 0," <> "\"abstainVotes\": 0}" diff --git a/govtool/backend/src/VVA/Proposal.hs b/govtool/backend/src/VVA/Proposal.hs index 86aff74bc..b68074e03 100644 --- a/govtool/backend/src/VVA/Proposal.hs +++ b/govtool/backend/src/VVA/Proposal.hs @@ -86,7 +86,6 @@ getProposals mProposalIds = withPool $ \conn -> do , about' , motivation' , rationale' - , references' , yesVotes' , noVotes' , abstainVotes' @@ -110,7 +109,6 @@ getProposals mProposalIds = withPool $ \conn -> do about' motivation' rationale' - references' (floor @Scientific yesVotes') (floor @Scientific noVotes') (floor @Scientific abstainVotes') diff --git a/govtool/backend/src/VVA/Types.hs b/govtool/backend/src/VVA/Types.hs index 6e71b36cc..dfcb1fb5f 100644 --- a/govtool/backend/src/VVA/Types.hs +++ b/govtool/backend/src/VVA/Types.hs @@ -125,7 +125,6 @@ data Proposal , proposalAbstract :: Maybe Text , proposalMotivation :: Maybe Text , proposalRationale :: Maybe Text - , proposalReferences :: Maybe Value , proposalYesVotes :: Integer , proposalNoVotes :: Integer , proposalAbstainVotes :: Integer