Skip to content

Commit

Permalink
chore:milestone completion in submit proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
naneey committed Sep 26, 2023
1 parent 83a6eef commit 90894d3
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -806,16 +806,24 @@ public void submitProgressReport(ProgressReportAttributes progressReport) {
Context.require(proposalKeyExists(ipfsHash), TAG + ": Invalid proposal key");
addNewProgressReportKey(ipfsHash, reportHash);
String reportHashPrefix = progressReportPrefix(reportHash);
if(progressReport.milestoneCompleted == null){
progressReport.milestoneCompleted = new int[]{};
}
addDataToProgressReportDB(progressReport, reportHashPrefix);
int proposalMilestoneCount = ProposalDataDb.getMilestoneCount(ipfsHashPrefix);
if (proposalMilestoneCount !=0 ) {
int[] milestones = progressReport.milestoneCompleted;

int[] milestones = progressReport.milestoneCompleted;
// TODO: check that submitted milestones are in proposal db
Context.require(milestones.length <= proposalMilestoneCount,
TAG + " Submitted milestone is greater than recorded on proposal.");

for (int milestone : milestones) {
for (int milestone : milestones) {

int milestoneStatus = getMileststoneStatusOf(ipfsHash,milestone);
if (milestoneStatus == MILESTONE_REPORT_COMPLETED || milestoneStatus == MILESTONE_REPORT_SUBMITTED) {
Context.revert("Cannot submit progress report of completed milestone"); // TODO: better error message
}
int milestoneStatus = getMileststoneStatusOf(ipfsHash, milestone);
if (milestoneStatus == MILESTONE_REPORT_COMPLETED || milestoneStatus == MILESTONE_REPORT_SUBMITTED) {
Context.revert(TAG + " Milestone already completed/submitted " + milestoneStatus);
}

MilestonesAttributes milestonesAttributes = new MilestonesAttributes();
milestonesAttributes.reportHash = reportHash;
Expand Down

0 comments on commit 90894d3

Please sign in to comment.