Skip to content

Commit

Permalink
chore: milestones added in proposal db for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
naneey committed Nov 10, 2023
1 parent 89a60b1 commit dc3af9a
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1409,11 +1409,7 @@ private void updateProgressReportResult() {
}


@External // TODO : remove in production
public void updateProposalPeriod(String ipfsHash){
String ipfsHashPrefix = proposalPrefix(ipfsHash);
proposalPeriod.at(ipfsHashPrefix).set(25);
}


private void updateProposalStatus(String _ipfs_hash, Map<String, Object> _proposal_details) {
String _proposal_status = (String) _proposal_details.get(STATUS);
Expand Down Expand Up @@ -2557,7 +2553,7 @@ public void updatePeriodCount(String newHash, int count) {
}

@External
public void submitProposalMock(ProposalAttributes newProposal, String oldHash, int[] milestones) {
public void submitProposalMock(ProposalAttributes newProposal, String oldHash, MilestonesAttributes[] milestones) {
String newHash = newProposal.ipfs_hash;
if (!containsInArrayDb(oldHash, activeProposals)) {
Context.revert(TAG + ": Proposal cannot be migrated.");
Expand Down Expand Up @@ -2592,6 +2588,14 @@ public void submitProposalMock(ProposalAttributes newProposal, String oldHash, i

addDataToProposalDB(newProposal, newIpfsHashPrefix);

for (MilestonesAttributes milestone: milestones) {
String milestonePrefix = mileStonePrefix(newIpfsHashPrefix,milestone.id);
addDataToMilestoneDb(milestone,milestonePrefix);
milestoneIds.at(newIpfsHashPrefix).add(milestone.id);
}



BigInteger timestamp = ProposalDataDb.timestamp.at(oldIpfsHashPrefix).getOrDefault(BigInteger.ZERO);
ProposalDataDb.timestamp.at(newIpfsHashPrefix).set(timestamp);
proposalPeriod.at(newIpfsHashPrefix).set(31);
Expand Down Expand Up @@ -2658,10 +2662,9 @@ public void submitProposalMock(ProposalAttributes newProposal, String oldHash, i
String progressReportStatus = ProgressReportDataDb.status.at(progressHashPrefix).getOrDefault("");

if (progressReportStatus.equals(APPROVED)) {
milestoneSubmitted.at(progressHashPrefix).add(milestones[i]);
milestoneSubmitted.at(progressHashPrefix).add(milestones[i].id);
}
String milestonePrefix = mileStonePrefix(newHash, milestones[i]);
MilestoneDb.id.at(milestonePrefix).set(milestones[i]);
String milestonePrefix = mileStonePrefix(newHash, milestones[i].id);
MilestoneDb.status.at(milestonePrefix).set(MILESTONE_REPORT_APPROVED);
MilestoneDb.progressReportHash.at(milestonePrefix).set(report);

Expand Down

0 comments on commit dc3af9a

Please sign in to comment.