I am working with the local-setup and I have a smart contract to vote for a provider. In my schema:
structs:
Proposal:
provider: String # provider name
value: Uint64 # service value
votes: Uint64 # votes amount
state:
proposals: Proposal[]
and I have a function to vote:
let propuestas: ArrayOfMutableProposal = f.state.proposals();
let nr_propuestas = propuestas.length();
let proveedor = f.params.proveedor().value();
for j in 0..nr_propuestas{
let mut prop: Proposal = propuestas.get_proposal(j).value();
if prop.provider== proveedor{
propuestas.get_proposal(j).value().votes = prop.votos + 1;
}
}
but the value of votes does not change, and when I try to define the winner, all proposals have 0 votes.
Could you help me please? Thank you