Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
Dont remove pendingAmountRemaining from donations
Browse files Browse the repository at this point in the history
related to Giveth/feathers-giveth#432
it was a mistake the we were deleting pendingAmountRemaining
  • Loading branch information
mohammadranjbarz committed May 12, 2021
1 parent 6aae9af commit 5dc7c95
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 32 deletions.
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
addCommitTimeForToApproveDonations,
fetchDonationsInfo,
fixConflictInDonations,
unsetPendingAmountRemainingFromCommittedDonations
} from "./services/donationService";
import {isReturnTransfer} from "./utils/donationUtils";
import {report} from "./utils/reportUtils";
Expand Down Expand Up @@ -770,7 +769,6 @@ const main = async () => {
// events
// }
// );
await unsetPendingAmountRemainingFromCommittedDonations();
console.table(report);
console.log('end of simulation ', new Date())
if (config.get('emailReport')) {
Expand Down
22 changes: 0 additions & 22 deletions src/services/donationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,6 @@ export async function fetchDonationsInfo():
}


export async function unsetPendingAmountRemainingFromCommittedDonations() {
const query = {
status: {$ne: DonationStatus.PENDING},
pendingAmountRemaining: {$exists: true}
};
const notPendingDonationsWithPendingAmountRemaining = await donationModel.find(query);
report.removedPendingAmountRemainingCount = notPendingDonationsWithPendingAmountRemaining.length;
console.log('Removed pendingAmountFromDonations count', notPendingDonationsWithPendingAmountRemaining.length)
notPendingDonationsWithPendingAmountRemaining.forEach(donation => {
logger.error('Remove pendingAmountFromDonations', {
_id: donation._id,
pendingAmountRemaining: donation.pendingAmountRemaining
})
})
await donationModel.updateMany(query, {
$set: {updatedBySimulationDate: new Date()},
$unset: {pendingAmountRemaining: 1}
})


}

export async function fixConflictInDonations(
options: {
unusedDonationMap: Map<string, any>,
Expand Down
7 changes: 1 addition & 6 deletions src/services/emailService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ export const sendReportEmail = async (reportData: ReportInterface) => {
<td style='${tableCellStyle}'>createdPledgeAdmins count</td>
<td style='${tableCellStyle}'>${reportData.createdPledgeAdmins}</td>
</tr>
<tr>
<td style='${tableCellStyle}'>removedPendingAmountRemainingCount</td>
<td style='${tableCellStyle}'>${reportData.removedPendingAmountRemainingCount}</td>
</tr>
</table>
`,
// cta: `Manage Milestone`,
Expand All @@ -109,8 +105,7 @@ export const sendReportEmail = async (reportData: ReportInterface) => {
reportData.createdPledgeAdmins ||
reportData.updateAmountRemaining ||
reportData.updatedDonations ||
reportData.deletedDonations ||
reportData.removedPendingAmountRemainingCount
reportData.deletedDonations
)
const summaryMessage = resolvedConflicts ?
'There were some conflicts that resolved' :
Expand Down
1 change: 0 additions & 1 deletion src/utils/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export interface ReportInterface {
fetchedNewPledgeCount: number,
fetchedNewPledgeAdminCount: number,
fetchedNewEventsCount: number,
removedPendingAmountRemainingCount: number,
}

export interface Token {
Expand Down
1 change: 0 additions & 1 deletion src/utils/reportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ export const report = {
fetchedNewEventsCount: 0,
fetchedNewPledgeAdminCount: 0,
fetchedNewPledgeCount: 0,
removedPendingAmountRemainingCount: 0
};

0 comments on commit 5dc7c95

Please sign in to comment.