Skip to content

Commit

Permalink
[ADJUST] ordering for better readability and fault tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
af-jml committed May 22, 2024
1 parent 2e48797 commit fa8b8d7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/modules/proposal/utils/revert-location-vote.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ export const revertLocationVote = async (
const locationState = getLocationState(proposal, user);

const uploadId = proposal.conditionalApprovals?.find((approval) => approval.location === location)?.uploadId;
if (uploadId) {
await proposalUploadService.deleteUpload(proposal, uploadId, user);
}
const conditionalApprovalFdpgTaskId = proposal.conditionalApprovals?.find(
(approval) => approval.location === location,
)?.fdpgTaskId;
Expand All @@ -30,12 +27,11 @@ export const revertLocationVote = async (
} else if (!locationState.isConditionalApproval && locationState.uacApproved) {
locationDataAmount = proposal.uacApprovals?.find((approval) => approval.location === location)?.dataAmount ?? 0;
}
proposal.totalPromisedDataAmount = proposal.totalPromisedDataAmount - locationDataAmount;

proposal.totalPromisedDataAmount = proposal.totalPromisedDataAmount - locationDataAmount;
proposal.uacApprovals = proposal.uacApprovals?.filter((approval) => approval.location !== location);
proposal.conditionalApprovals = proposal.conditionalApprovals?.filter((condition) => condition.location !== location);
proposal.declineReasons = proposal.declineReasons?.filter((reason) => reason.location !== location);

clearLocationsVotes(proposal, location);
proposal.openDizChecks.push(location);

Expand All @@ -49,4 +45,8 @@ export const revertLocationVote = async (
}

removeFdpgTaskByType(proposal, FdpgTaskType.UacApprovalComplete);

if (uploadId) {
await proposalUploadService.deleteUpload(proposal, uploadId, user);
}
};

0 comments on commit fa8b8d7

Please sign in to comment.